Skip to content

Commit

Permalink
Allow passing either file bytes or filename when loading .mat files.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 696075023
  • Loading branch information
IanRDavies authored and Torax team committed Nov 13, 2024
1 parent acecc2f commit 1770818
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions torax/geometry_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
# limitations under the License.

"""File I/O for loading geometry files."""

import enum
import os
from typing import IO

import eqdsk
import numpy as np
Expand Down Expand Up @@ -56,8 +58,8 @@ def _load_CHEASE_data( # pylint: disable=invalid-name
}


def _load_fbt_data(file_path: str) -> dict[str, np.ndarray]:
"""Loads the data from a FBT-LY file into a dictionary."""
def _load_fbt_data(file_path: str | IO[bytes]) -> dict[str, np.ndarray]:
"""Loads data into a dictionary from an FBT-LY file or file path."""
return scipy.io.loadmat(file_path, squeeze_me=True)


Expand Down

0 comments on commit 1770818

Please sign in to comment.