ibex.data_source.data_source_interface.DataSourceInterface

class ibex.data_source.data_source_interface.DataSourceInterface

Bases: ABC

Methods

array_summary(uri, ids, node_path[, occurrence])

Returns short summary of array node as a dictionary

data_entry_exists(uri)

Check if data entry can be opened

data_serializer_custom(obj)

Custom data sub-serializer.

find_paths(uri, ids, searched_node[, occurrence])

Finds paths containing phrase passed in searched_node argument

get_data(uri, ids, node_path[, occurrence, ...])

Returns data extracted from IDS, converted into dictionary

get_node_info(uri, ids, node_path[, ...])

Returns dictionary with basic info about IDS node pointed by node_path argument

get_plot_data(plot_data_query)

Returns all data used to plot selected quantity.

list_db_entries(user[, backends, database, ...])

Returns list of available data entries

list_idses(uri)

Returns list of IDSes with occurrence numbers that are filled in given data entry uri

abstractmethod array_summary(uri: str, ids: str, node_path: str, occurrence: int = 0) dict

Returns short summary of array node as a dictionary

Parameters:
uri: str

imas URI

ids: str

name of ids e.g. core_profiles

node_path: str

path to ids node e.g. ids_properties/version_put

occurrence: int = 0

ids occurrence number

Returns:

dictionary {‘shape’: [<dim1>,<dim2>, …], ‘min’:<min_value>, ‘max’:<max_value>, ‘mean’:<mean>, ‘standard_deviation’:<s_d>}

abstractmethod data_entry_exists(uri: str) bool

Check if data entry can be opened

Parameters:
uri: str

imas URI

Returns:

True if entry can be opened, False otherwise

abstractmethod data_serializer_custom(obj)

Custom data sub-serializer. Replaces arbitrary objects with ones supported by ORJSON serializer (IDSNumericArray -> np.array).

abstractmethod find_paths(uri: str, ids: str, searched_node: str, occurrence: int = 0) dict

Finds paths containing phrase passed in searched_node argument

Parameters:
uri: str

imas URI

ids: str

name of ids e.g. core_profiles

searched_node: str

searched text

occurrence: int = 0

ids occurrence number

Returns:

dictionary {‘paths’: [‘path/to/node1’,’path/to/node2’, …]}

abstractmethod get_data(uri: str, ids: str, node_path: str, occurrence: int = 0, downsampling_method: str | None = None, downsampled_size: int = 1000) dict

Returns data extracted from IDS, converted into dictionary

Parameters:
uri: str

imas URI

ids: str

name of ids e.g. core_profiles

node_path: str

path to ids node e.g. ids_properties/version_put

occurrence: int = 0

ids occurrence number

downsampling_method: str | None = None

method to be used during downsampling process

downsampled_size: int = 1000

target size for downsampling

Returns:

dictionary {‘value’:<node_value>}, where <node_value> represents data extracted from IDS node

abstractmethod get_node_info(uri: str, ids: str, node_path: str, occurrence: int = 0, recursive: bool = False, show_error_bars: bool = False) dict

Returns dictionary with basic info about IDS node pointed by node_path argument

Parameters:
uri: str

pulsefile uri - used only to get proper DD version

ids: str

name of ids e.g. core_profiles

node_path: str

path to ids node e.g. ids_properties/version_put

occurrence: int = 0

ids occurrence number

recursive: bool = False

if True, creates node_info tree. If False, returns only pointed node and it’s children node_info

show_error_bars: bool = False

whether error bar nodes should be returned, or not

Returns:

get_plot_data(plot_data_query: PlotDataRequestModel) dict

Returns all data used to plot selected quantity. Result contains data values, metadata and coordinates.

Parameters:
plot_data_query: PlotDataRequestModel

See ibex.endpoints.schemas.request_data_schemas.PlotDataRequestModel

Returns:

Dictionary containing data values, metadata and coordinates.

abstractmethod list_db_entries(user: str, backends: Sequence[str] | None = None, database: str | None = None, version: int | None = None) dict

Returns list of available data entries

Parameters:
user: str

owner of searched data entry

backends: Sequence[str] | None = None

searched backends [<be1>, <be2>, …]: default(None)

database: str | None = None

searched database name: default(None)

version: int | None = None

searched AL major version:

Returns:

dictionary {‘entries’: [<uri1>, <uri2>, …]}

abstractmethod list_idses(uri: str) dict

Returns list of IDSes with occurrence numbers that are filled in given data entry uri

Parameters:
uri: str

imas URI

Returns:

dictionary: {‘idses’: [{‘name’:<name>, ‘occurrences’:[<0>,<1>,…]}, {‘name’: …}]}