tardis.io.util module¶
- class tardis.io.util.HDFWriterMixin(*args, **kwargs)[source]¶
 Bases:
object- property full_hdf_properties¶
 
- to_hdf(file_path_or_buf, path='', name=None, overwrite=False)[source]¶
 - Parameters
 - file_path_or_bufstr or pandas.io.pytables.HDFStore
 Path or buffer to the HDF file
- pathstr
 Path inside the HDF file to store the
elements- namestr
 Group inside the HDF file to which the
elementsneed to be saved- overwritebool
 If the HDF file path already exists, whether to overwrite it or not
- static to_hdf_util(path_or_buf, path, elements, overwrite, complevel=9, complib='blosc')[source]¶
 A function to uniformly store TARDIS data to an HDF file.
Scalars will be stored in a Series under path/scalars 1D arrays will be stored under path/property_name as distinct Series 2D arrays will be stored under path/property_name as distinct DataFrames
Units will be stored as their CGS value
- Parameters
 - path_or_bufstr or pandas.io.pytables.HDFStore
 Path or buffer to the HDF file
- pathstr
 Path inside the HDF file to store the
elements- elementsdict
 A dict of property names and their values to be stored.
- overwritebool
 If the HDF file path already exists, whether to overwrite it or not
Notes
overwriteoption doesn’t have any effect whenpath_or_bufis an HDFStore because the user decides on the mode in which they have opened the HDFStore (‘r’, ‘w’ or ‘a’).
- class tardis.io.util.MockRegexPattern(target_type)[source]¶
 Bases:
objectA mock class to be used in place of a compiled regular expression when a type check is needed instead of a regex match.
Notes
This is usually a lot slower than regex matching.
- class tardis.io.util.PlasmaWriterMixin(*args, **kwargs)[source]¶
 Bases:
HDFWriterMixin- to_hdf(file_path_or_buf, path='', name=None, collection=None, overwrite=False)[source]¶
 - Parameters
 - file_path_or_bufstr or pandas.io.pytables.HDFStore
 Path or buffer to the HDF file
- pathstr
 Path inside the HDF file to store the
elements- namestr
 Group inside the HDF file to which the
elementsneed to be saved- collection
 Noneor aPlasmaPropertyCollectionof which members are the property types which will be stored. IfNonethen all types of properties will be stored. This acts like a filter, for example if a value ofproperty_collections.basic_inputsis given, only those input parameters will be stored to the HDF file.- overwritebool
 If the HDF file path already exists, whether to overwrite it or not
- class tardis.io.util.YAMLLoader(stream)[source]¶
 Bases:
LoaderA custom YAML loader containing all the constructors required to properly parse the tardis configuration.
Initialize the scanner.
- construct_quantity(node)[source]¶
 A constructor for converting quantity-like YAML nodes to
astropy.units.Quantityobjects.- Parameters
 - node
 The YAML node to be constructed
- Returns
 
- tardis.io.util.download_from_url(url, dst, src=None)[source]¶
 Download files from a given URL
- Parameters
 - urlstr
 URL to download from
- dststr
 Destination folder for the downloaded file
- srclist
 List of URLs to use as mirrors
- tardis.io.util.get_internal_data_path(fname)[source]¶
 Get internal data path of TARDIS
- Returns
 - data_pathstr
 internal data path of TARDIS
- tardis.io.util.quantity_from_str(text)[source]¶
 Convert a string to
astropy.units.Quantity- Parameters
 - text
 The string to convert to
astropy.units.Quantity
- Returns
 
- tardis.io.util.traverse_configs(base, other, func, *args)[source]¶
 Recursively traverse a base dict or list along with another one calling
funcfor leafs of both objects.- Parameters
 - base
 The object on which the traversing is done
- other
 The object which is traversed along with
base- func
 A function called for each leaf of
baseand the correspnding leaf ofotherSignature:func(item1, item2, *args)- args
 Arguments passed into
func