astrohack.io.base_mds¶
Module Contents¶
Classes¶
Base Data class for astrohack. |
-
class
AstrohackBaseFile(file: str)[source]¶ Base Data class for astrohack.
Data within an object of this class can be selected for further inspection, plotted or produce a report
-
property
is_open(self) → bool[source]¶ Check whether the object has opened the corresponding hack file.
- Returns
True if open, else False.
- Return type
bool
-
keys(self, *args, **kwargs)[source]¶ Get children keys
- Parameters
args (list) – args to deliver to dict.keys() method
kwargs (dict) – Dict of keyword args to deliver to dict.keys() method
- Returns
dict keys iterable
- Return type
dict_keys
-
items(self, *args, **kwargs)[source]¶ Get children items
- Parameters
args (list) – args to deliver to dict.items() method
kwargs (dict) – Dict of keyword args to deliver to dict.items() method
- Returns
dict items iterable
- Return type
dict_items
-
values(self, *args, **kwargs)[source]¶ Get children values
- Parameters
args (list) – args to deliver to dict.values() method
kwargs (dict) – Dict of keyword args to deliver to dict.values() method
- Returns
dict values iterable
- Return type
dict_values
-
open(self, file: str = None) → bool[source]¶ Open Base file.
- Parameters
file (str, optional) – File to be opened, if None defaults to the previously defined file
- Returns
True if file is properly opened, else returns False
- Return type
bool
-
write(self, mode='w')[source]¶ Write mds to disk by saving the data tree to a file
- Parameters
mode (str) – File mode
-
summary(self) → None[source]¶ Prints summary of this Astrohack File object, with available data, attributes and methods
- Returns
None
- Return type
NoneType
-
classmethod
create_from_input_parameters(cls, file_name: str, input_parameters: dict)[source]¶ Create an AstrohackBaseFile object from a filename and initializes xdtree root attributes.
- Parameters
file_name (str) – Name of the file in disk to be created
input_parameters (dict) – Input parameters for the calling function to be stored in root attributes.
- Returns
Initialized AstrohackBaseFile object
- Return type
-
add_node(self, xarray_data: Union[xarray.Dataset, xarray.DataTree], key_list: Union[list[str], tuple[str]])[source]¶ Add a node to the data tree file structure, however this node is not yet consolidated into the data tree structure, consolidate must be called to integrate all nodes writen by add_node onto the tree structure.
- Parameters
xarray_data (xr.DataSet, xr.DataTree) – XDS or XDT to be included into the data tree structure.
key_list (list, tuple) – list of data identifying keys to determine where to add node
- Returns
None
- Return type
NoneType
-
is_close_to(self, other_mds, tol=1e-06)[source]¶ Tests if self and other_mds are close to each other.
- Parameters
other_mds (AstrohackBaseFile) – Another mds
tol (float) – Tolerance
- Returns
True if Mdses are close up to tolerance
- Return type
bool
-
property