MesaProfileIndex is a class that gives rudimentary access to the relationship between profiles and model numbers typically stored in profiles.index. This is mostly used on the backend of MesaLogDir to easily find profiles, but it can also be used on its own.
Structure containing data from the profile index from MESA output.
Reads in data from profile index file from MESA, allowing a mapping from profile number to model number and vice versa. Mostly accessed via the MesaLogDir class.
Parameters: file_name (str, optional) – Path to the profile index file to be read in. Default is ‘LOGS/profiles.index’, which should work when the working directory is a standard work directory and the logs directory is of the default name.
str – path to the profile index file
dict – dictionary containing all index data in numpy arrays.
str – header name of the model number column in file_name
str – header name of the profile number column in file_name
numpy.ndarray – List of all available profile numbers in order of their corresponding model numbers (i.e. time-order).
numpy.ndarray – Sorted list of all available model numbers.
Access index data and return array of column corresponding to key.
Parameters: key (str) – Name of column to be returned. Likely choices are ‘model_numbers’, ‘profile_numbers’, or ‘priorities’. Returns: Array containing the data requested. Return type: numpy.ndarray Raises:
KeyError– If input key is not a valid column header name.
Determines if given model_number has a matching profile number.
int – model number to be checked for available profile number
Returns: True if model_number has a corresponding profile number. False otherwise. Return type: bool
Determines if given profile_number is a valid profile number.
int – profile number to be verified
Returns: True if profile_number has a corresponding entry in the index. False otherwise. Return type: bool
Converts a profile number to a profile number if possible.
If profile_number has a corresponding model number in the index, returns it. Otherwise throws an error.
int – profile number to be converted into a model number
Returns: model number corresponding to profile_number Return type: int Raises:
ProfileError– If no model number can be found that corresponds to profile_number
Converts a model number to a profile number if possible.
If model_number has a corresponding profile number in the index, returns it. Otherwise throws an error.
int – model number to be converted into a profile number
Returns: profile number corresponding to model_number Return type: int Raises:
ProfileError– If no profile number can be found that corresponds to model_number
Read (or re-read) data from self.file_name.
Read the file into an numpy array, sorting the table in order of increasing model numbers and establishes the profile_numbers and model_numbers attributes. Converts data and names into a dictionary. Called automatically at instantiation, but may be called again to refresh data.
Returns: Return type: None