wsssss package
Subpackages
- wsssss.inlists package
- Submodules
- wsssss.inlists.create_grid module
MesaGridMesaGrid.__init__()MesaGrid.add_file()MesaGrid.add_dir()MesaGrid.add_inlist_option_file_check()MesaGrid.add_no_expand_key()MesaGrid.add_non_mesa_key()MesaGrid.set_inlist_finalize_function()MesaGrid.set_griddir_finalize_function()MesaGrid.set_name_function()MesaGrid.create_grid()MesaGrid.validate_inlists()MesaGrid._validate_files()MesaGrid._get_available_options()MesaGrid.check_copy()MesaGrid.unpack_inlists()MesaGrid._make_inlist_generator()MesaGrid._setup_directories()MesaGrid._write_inlists()MesaGrid._generate_inlist_string()MesaGrid._copy_extra_files_and_dirs()MesaGrid.summary()
- wsssss.inlists.inlists module
- Module contents
- wsssss.plotting package
- Submodules
- wsssss.plotting.kipp module
- wsssss.plotting.plotting module
calc_vhrd()plot_vhrd()make_vhrd()plot_hrd_data()make_hrd()make_propagation()make_propagation2()make_echelle()make_inertia()make_resolutions()make_hrd_profiles()make_hrd_models()make_age_nu()make_mesa_gyre_delta_nu()make_composition()make_gradients()make_period_spacing()make_structural()make_eigenfunc_compare()make_kipp()
- wsssss.plotting.utils module
HandlerDashedLinesMidpointBoundaryNormget_figure()top_legend()top_figure_legend()side_figure_legend()colored_line()hrd_const_rad()get_x_and_set_xlabel()get_mix_dict()get_mixing()get_default_mixing_kwargs()add_mixing()add_burning()add_hrd_instabilities()calc_inertia_marker_size()line_legend()decimate_RDP()
- Module contents
- wsssss.constants package
- Submodules
- wsssss.constants.post15140 module
versionmax_extra_inlistspipi2pi4eulerconeulernumln2ln3lnpiln10iln10a2radrad2aone_thirdtwo_thirdsfour_thirdsfive_thirdsone_sixthfour_thirds_piln4pi3two_13four_13sqrt2sqrt_2_div_3avoamuclightqekergboltzmplanck_hhbarcgasev2ergmev_to_ergsmev_amumev2grqconvkevboltz_sigmacradaupcdayyersecdaysecyerlymnmpmerbohrfinehionsigeweinberg_thetanum_neu_famstandard_cgravmu_sunmu_earthmu_jupiteragesunmsunrsunlsunteffsunloggsunmbolsunm_earthr_earthr_earth_polarm_jupiterr_jupiterr_jupiter_polarsemimajor_axis_jupiterarg_not_providedmissing_valuecrystallizedno_mixingconvective_mixingovershoot_mixingsemiconvective_mixingthermohaline_mixingrotation_mixingrayleigh_taylor_mixingminimum_mixinganonymous_mixingleftover_convective_mixingphase_separation_mixingnumber_of_mixing_types
- wsssss.constants.pre15140 module
versionpipi4eulerconln2ln3ln10a2radrad2aone_thirdtwo_thirdsln4pi3two_13four_13sqrt2standard_cgravplanck_hhbarqeavoclightkergboltzmcgaskevamumnmpmerbohrfinehionev2ergmev_to_ergsmev_amuqconvboltz_sigmacradsigessolasolweinlamweinfrerhonucmsolrsollsolagesolmsunrsunlsunmsun33rsun11lsun33teffsolloggsolteffsunloggsunmbolsunmbolsollypcsecyerdayyerm_earthr_earthaum_jupiterr_jupitersemimajor_axis_jupiterarg_not_providedmissing_valueno_mixingconvective_mixingsoftened_convective_mixingovershoot_mixingsemiconvective_mixingthermohaline_mixingrotation_mixingrayleigh_taylor_mixingminimum_mixinganonymous_mixing
- Module contents
Submodules
wsssss.functions module
- wsssss.functions.get_mesa_version(mesa_dir)
Get the version of MESA in mesa_dir
- Parameters:
mesa_dir (str) – Path to MESA directory.
- Returns:
Version string
- Return type:
str
Examples
>>> get_mesa_version(os.environ['MESA_DIR']) '24.03.1'
- wsssss.functions.compare_version(version1, version2, operator)
Compare two MESA versions.
- Parameters:
version1 (str) – LHS of comparison.
version2 (str) – RHS of comparison.
operator (str) – Comparison operator string. Can be one of ‘<’, ‘>’, ‘<=’, ‘>=’, ‘==’, ‘!=’.
- Returns:
Result of performing the comparison.
- Return type:
bool
Examples
>>> compare_version('11701', '8118', '<') # '11701' < '8118' would return True. False
- wsssss.functions.get_constants(p_or_hist)
Get the correct MESA constants used for p_or_hist.
- wsssss.functions.convert_mixing_type(mix_type, version, unknown_mixing=100, other_mixing=[(None, None)])
Convert the mixing type codes to a merged version compatible with pre- and post-15140 MESA.
- Parameters:
mix_type (np.array)
version (str) – MESA version
unknown_mixing (int, optional) – Mixing type code to use for unreckognized mixing type code. Defaults to 100, which is the merged code for no_mixing.
other_mixing (list of tuple(str, int), optional) – Information on custom mixing types. (name, mix_type_code)
- Returns:
New mixing type codes associated with mix_type.
- Return type:
np.array
- wsssss.functions.cell2face(val, dm, dm_is_m=False, m_center=0)
Convert a cell average value (e.g. density) to the value at the cell face (e.g. radius).
- Parameters:
val (np.array) – Value to convert.
dm (np.array) – Cell mass or mass coordinate if dm_is_m is True.
dm_is_m (bool, optional) – If True, treat dm as mass coordinate instead of cell mass.
(float (m_center) – If dm_is_m is True, set this as the interior mass.
optional – If dm_is_m is True, set this as the interior mass.
- Returns:
Value at cell face of val.
- Return type:
np.array
- wsssss.functions.get_logTeffL(hist, mask=None, linear=False)
- wsssss.functions.get_radius(p, unit='cm')
Get the radius from Profile p and perform a unit conversion with the correct constants.
- Parameters:
p (Profile)
unit (str)
- Returns:
Radial coordinate in unit.
- Return type:
array-like
- wsssss.functions.get_m_bot_CZ(hist, mask=None, max_q_bot=0.999)
Get the mass coordinate of the bottom of the convective envelope.
- Parameters:
hist (History)
mask (bool, np.array, or function, optional) – If True, will exclude pre-main sequence. If an array of bools will use that as mask. If a function, will call function(hist) and use that as the mask.
max_q_bot (float, optional) – Maximum dimensionless mass coordinate below which to look for the bottom of the convective envelope.
- Returns:
Bottom of the convective envelope.
- Return type:
array-like
- wsssss.functions.get_cheb_mask(hist, min_Yc=1e-06, max_Yc=1.0)
Get the Core Helium Burning mask for hist.
Defined as: * Have helium in core * Have convective core * Hydrogen depleted core
- Parameters:
hist (History)
min_Yc (float, optional) – Minimum central helium mass fraction. Defaults to 1e-6.
max_Yc (float, optional) – Maximum central helium mass fraction. Defaults to 1.0.
- Return type:
array of bool
- wsssss.functions.get_rc_mask(hist, min_Yc=0.1, max_fYc=0.95, first_chunk=False)
Get the Red Clump mask for hist.
Defined as: Have helium in core Have convective core Hydrogen depleted core
- Parameters:
hist (History)
min_Yc (float, optional) – Minimum central helium mass fraction. Defaults to 0.1.
max_fYc (float, optional) – Maximum central helium mass fraction factor. This factor is multiplied by the maximum Yc achieved during evolution to get the value which is compared against. Defaults to 0.95.
first_chunk (bool, optional) – If True, only returns the mask for the first contiguous block of True in the mask.
- Return type:
array of bool
- wsssss.functions.get_pms_mask(hist, invert=False, ZAMS_method='Xc', fXc=0.99)
Get the pre-main sequence mask for hist.
- Parameters:
hist (History)
invert (bool, optional) – If True, invert the PMS mask. Defaults to False.
ZAMS_method (str or callable, optional) – Can be ‘Xc’, or ‘LH’. If ‘Xc’, will use when X_c reaches
fXcof the initial central hydrogen mass fraction. If ‘LH’, will end when the hydrogen burning luminosity is equal to total luminosity. If ZAMS_method is callable will callZAMS_method(hist), which should return a mask with the same length as hist. Defaults to ‘Xc’.fXc (float, optional) – Define the end of PMS as when central hydrogen mass fraction reaches
fXcof the initial value. Defaults to 0.99
- Return type:
array of bool
- wsssss.functions.get_ms_mask(hist, min_Xc=0.001, ZAMS_method='Xc')
Get the main sequence mask for hist.
- Parameters:
hist (History)
min_Xc (float) – Minimum central hydrogen mass fraction for the end of the MS.
ZAMS_method (str, optional) – See get_pms_mask for details. Defaults to ‘Xc’.
- Return type:
array of bool
- wsssss.functions.get_sgb_mask(hist, min_Xc=0.001, fCZ=0.35)
Get the sub-giant branch mask.
- Parameters:
hist (History)
min_Xc (float) – Minimum central hydrogen mass fraction for the end of the MS.
fCZ (float) – Convective envelope mass fraction limit for end of SGB.
- Return type:
array of bool
- wsssss.functions.get_bump_mask(hist, max_logT_lim=3.8, min_logT_lim=3.6, min_logL=0.5)
Get the RGB bump mask.
Defined as having an increasing effective temperature on the RGB within the Teff and L limits.
- Parameters:
hist (History)
max_logT_lim (float, optional) – Maximum logT below which to look for the RGBb. Defaults to 3.8.
min_logT_lim (float, optional) – Minimum logT below which to look for the RGBb. Defaults to 3.6.
min_logL (float, optional) – Minimum logL above which to look for the RGBb. Defaults to 0.5.
- Return type:
array of bool
- wsssss.functions.get_tip_mask(hist, logT_lim=3.8, min_logL=2.0)
Get the RGB tip mask for hist.
- Parameters:
hist (History)
logT_lim (float, optional) – Maximum logT below which to look for the RGB tip.
- Return type:
array of bool
- wsssss.functions.get_rgb_mask(hist, min_Xc=0.001, logT_lim=3.8)
Get the RGB mask for hist.
- Parameters:
hist (History)
min_Xc (float, optional) – Minimum central hydrogen mass fraction for the end of the MS, passed to get_sgb_mask. Defaults to 1e-3.
logT_lim (float, optional) – Maximum logT below which to look for the end of the RGB. Defaults to 3.8.
- Return type:
array of bool
- wsssss.functions.get_flashes_mask(hist, logT_lim=3.8)
Get the helium flashes mask. Starts after the RGB tip and ends when CHeB starts.
- Parameters:
hist (History)
logT_lim (float, optional) – Passed to get_tip_mask to get the start of He-flashes.
- Return type:
array of bool
- wsssss.functions.get_mask(hist, use_mask)
Evaluate a mask.
- Parameters:
hist (History)
use_mask (bool, np.array, or function, optional) – If True, will exclude pre-main sequence. If an array of bools will use that as mask. If a function, will call function(hist) and use that as the mask.
- Return type:
array of bool
- wsssss.functions.get_mean(hist, name, use_mask=None, domain='star_age', filter=None, get_std=False, verbose=True)
Calculate the average of a quantity defined by name over domain.
- Parameters:
hist (History)
name (str, array, function) – Quantity in hist to average. Can be a column name in hist, an array with the same length as hist, an array with the mask specified by use_mask already applied, or a function with signature function(hist, mask).
use_mask (bool, np.array, or function, optional) – If True, will exclude pre-main sequence. If an array of bools will use that as mask. If a function, will call function(hist) and use that as the mask.
domain (str, array, optional) – Domain over which to average. Must be monotonically increasing or decreasing. Can be a column name in hist, or an array with the same length as hist. Defaults to ‘star_age’.
filter (str, optional) – Quantities to mask out. Can be one of ‘negative’, ‘-’, ‘-ve’, ‘positive’, ‘+’, ‘+ve’, ‘finite’, ‘inf’, ‘nan’, None. Defaults to None.
get_std (bool, optional) – If True, will also return the standard deviation.
- Returns:
The average
- Return type:
float or Tuple of floats
- wsssss.functions.get_weighted_quantile(x, w, q=(0.15865, 0.5, 0.84135))
Calculate the weighted quantile of x using weights w.
- Parameters:
x
w (array) – Weights of x.
q (tuple of floats) – Quantiles at which to calculate.
Returns:
- wsssss.functions.get_instability_strip(Z, Y, logL_min=3, logL_max=4.5, kind='RRLyrae')
- wsssss.functions.get_evo_phase(hist, phase_funcs)
- Parameters:
hist
phase_funcs
Returns:
- wsssss.functions.get_evo_stretch_func(hist, xaxis='star_age', phase_funcs=None)
- wsssss.functions.get_bottom_envelope(p, indeces_only=False)
- Parameters:
p
indeces_only
Returns:
- wsssss.functions.get_lamb2(p, l=1)
- wsssss.functions.calc_MH(hist, ZX_sol=0.0178, use_mask=None)
Calculate [M/H] from hist.
- Parameters:
hist
ZX_sol (float, optional) – Solar value for Z/X. Defaults to 0.0178.
use_mask (bool, np.array, or function, optional) – If True, will exclude pre-main sequence. If an array of bools will use that as mask. If a function, will call function(hist) and use that as the mask.
Returns:
- wsssss.functions.calc_deltanu(gs, hist, prefix='profile', suffix='.data.GYRE.sgyre_l', freq_units='uHz')
Calculate the large frequency separation Delta nu.
- Parameters:
gs (GyreSummary)
hist (History)
prefix (str, optional) – Part of gyre summary name before the profile number. Defaults to ‘profile’.
suffix (str, optional) – Part of gyre summary name after the profile number. Defaults to ‘.data.GYRE.sgyre_l’.
freq_units (str) – Unit to convert to, must be one of ‘uHz’, ‘mHz’, or ‘Hz’.
- Returns:
Large frequency separation Deltanu.
- Return type:
float
- wsssss.functions.calc_deltaPg(gs, hist, l, prefix='profile', suffix='.data.GYRE.sgyre_l')
Calculate the period spacing Delta P weighted by the power spectrum envelope. :param gs: :type gs: GyreSummary :param hist: :type hist: History :param l: Degree of modes. :type l: int :param prefix: Part of gyre summary name before the profile number. Defaults to ‘profile’. :type prefix: str, optional :param suffix: Part of gyre summary name after the profile number. Defaults to ‘.data.GYRE.sgyre_l’. :type suffix: str, optional
- Returns:
Period spacing Delta P.
- Return type:
float
- wsssss.functions.correct_seismo(hist, gsspnum, mask, xname='center_he4', do_deltanu=True, do_deltaP=True, prefix='profile', suffix='.data.GYRE.sgyre_l', get_poly=False, weight=True)
Calculate corrected delta_nu and delta_Pg using GyreSummary instances in gsspnum. The correction is done by fitting a 2nd order polynomial to the ratio of delta_nu from the History and from the GyreSummary instances and likewise for delta_Pg.
- Parameters:
hist (History)
gsspnum (Tuple of GyreSummary, int) – Calculate using
wsssss.load_data.load_gss(..., return_pnums=True, ...).mask (bool, np.array, or function, optional) – If True, will exclude pre-main sequence. If an array of bools will use that as mask. If a function, will call function(hist) and use that as the mask.
xname (str, optional) – Domain to use when fitting.
do_deltanu (bool, optional) – If True, calculate the delta_nu correction. Defaults to True.
do_deltaP (bool, optional) – If True, calculate the delta_Pg correction. Defaults to True.
prefix (str, optional) – Part of gyre summary name before the profile number. Defaults to ‘profile’.
suffix (str, optional) – Part of gyre summary name after the profile number. Defaults to ‘.data.GYRE.sgyre_l’.
get_poly (bool, optional) – If True, returns the correction polynomials instead of corrected values.
weight (bool, optional) – If True, weight points by distance in domain, giving sparse points more weight.
- Returns:
If do_deltanu is True, returns the corrected delta_nus. If do_deltaP is True, also returns corrected delta_Pg. If get_poly is True, returns the the correction polynomials instead of corrected values.
- wsssss.functions.calc_ModDens(numax, deltanu, deltap)
Calculate mode density.
- Parameters:
numax
deltanu
deltap
- Returns:
Mode density
- wsssss.functions.calc_abundance(hist, use_mask=None)
Calculate surface abundances. Returns abundances (by element, not isotope) and element names. :param hist: :param use_mask: If True, will exclude pre-main sequence.
If an array of bools will use that as mask. If a function, will call function(hist) and use that as the mask.
- Returns:
Array containing surface abundances.
- Return type:
array
wsssss.load_data module
This module contains various functions to load MESA and/or GYRE data.
Examples
Load a history file and the first profile:
>>> import wsssss.load_data as ld
>>> hist = ld.History('path/to/LOGS/history.data')
>>> prof = ld.Profile('path/to/LOGS/profile1.data')
>>> # or load all associated profiles:
>>> profs = ld.load_profs(hist)
- class wsssss.load_data.History(path, index_name='profiles.index', keep_columns='all', save_dill=True, reload=False, verbose=False, nanval=-1e+99, nanclip=None, empty_on_error=False)
Bases:
_Mesa- __init__(path, index_name='profiles.index', keep_columns='all', save_dill=True, reload=False, verbose=False, nanval=-1e+99, nanclip=None, empty_on_error=False)
Load a MESA history.
- Parameters:
path (str) – Path to the MESA history data file. If ending with .dill, will strip it and set that as path.
index_name (str, optional) – Filename of the profile index.
keep_columns (list of str, optional) – Which columns of the history data file to keep.
save_dill (bool, optional) – If True, will write a .dill file containing the History data. This file will include all columns, even those removed by keep_columns.
reload (bool, optional) – If True, will ignore a pre-existing .dill file and reload from the history file.
verbose (bool, optional) – Print extra information.
nanval (float, optional) – Set all values equal to this to NaN.
nanclip (2 floats, optional) – Set all values outside this range to NaN.
empty_on_error (bool, optional) – If loading fails, return an empty History.
- get_profile_num(model_num, method='closest', earlier=True)
Returns the closest (by default) or previous or next profile number for a given model number. If earlier is True, and there are two closest profiles, return the one with a lower model number.
- Parameters:
model_num (int)
method (str) – Must be one of closest or previous.
earlier (bool)
- Returns:
A tuple (header, columns, first_line), where header is a dict containing the header of the data file, columns is a list of column names, and first_line a np.rec.array containing the first row of data.
- Returns:
A tuple (pnum, pmod, hist_ind), where pnum is the profile number, pmod is the model number of Profile, and hist_ind the index in History of Profile.
- get_profile_index(profile_nums)
Returns the corresponding indeces of profile_nums. profile_nums can be an integer, a list of integers, a Profile, or a list of `Profile`s.
- Parameters:
profile_nums (int or list of int) – Profile numbers for which to calculate the indeces.
- Returns:
Indeces of profile_nums in History.
- Return type:
int or np.array of int
- _scrub_hist()
Scrub history data for backups and retries.
- class wsssss.load_data.Profile(path, index_name='profiles.index', keep_columns='all', load_GyreProfile=False, suffix_GyreProfile='.GYRE', save_dill=False, reload=False, verbose=False, nanval=-1e+99, nanclip=None)
Bases:
_Mesa- __init__(path, index_name='profiles.index', keep_columns='all', load_GyreProfile=False, suffix_GyreProfile='.GYRE', save_dill=False, reload=False, verbose=False, nanval=-1e+99, nanclip=None)
Load a MESA profile.
- Parameters:
path (str) – Path to the MESA profile data file. If ending with .dill, will strip it and set that as path.
index_name (str, optional) – Filename of the profile index.
keep_columns (list of str, optional) – Which columns of the history data file to keep.
load_GyreProfile (bool) – If True, will also load the corresponding GyreProfile into Profile.GyreProfile.
suffix_GyreProfile (str, optional) – Suffix of GyreProfile. Defaults to ‘.GYRE’.
save_dill (bool, optional) – If True, will write a .dill file containing the History data.
reload (bool, optional) – If True, will ignore a pre-existing .dill file and reload from the history file.
verbose (bool, optional) – Print extra information.
nanval (float, optional) – Set all values equal to this to NaN.
nanclip (2 floats, optional) – Set all values outside this range to NaN.
- class wsssss.load_data.GyreSummary(path, keep_columns='all', gyre_version='7', save_dill=False, reload=False, verbose=False, nanval=-1e+99, nanclip=None)
Bases:
_Gyre- __init__(path, keep_columns='all', gyre_version='7', save_dill=False, reload=False, verbose=False, nanval=-1e+99, nanclip=None)
Gyre summary output.
- Parameters:
path (str) – Path to the Gyre summary data file. If ending with .dill, will strip it and set that as path.
keep_columns (list of str, optional) – Which columns of the history data file to keep.
gyre_version (str) – Gyre version.
save_dill (bool, optional) – If True, will write a .dill file containing the History data.
reload (bool, optional) – If True, will ignore a pre-existing .dill file and reload from the history file.
verbose (bool, optional) – Print extra information.
nanval (float, optional) – Set all values equal to this to NaN.
nanclip (2 floats, optional) – Set all values outside this range to NaN.
- _dimless_to_Hz()
- Returns:
Conversion factor between dimensionless frequency and Hz.
- Return type:
float
- get_frequencies(freq_units, Re_freq_unit='uHz')
Get frequencies in the specicied units. Will use ‘Re(omega)’ first and ‘Re(freq)’ otherwise. :param freq_units: Unit to convert to, must be one of ‘uHz’, ‘mHz’, or ‘Hz’. :type freq_units: str :param Re_freq_unit: Unit of the ‘Re(freq)’ column, must be one of ‘uHz’, ‘mHz’, or ‘Hz’. :type Re_freq_unit: str, optional
- Returns:
Frequencies in unit specified by Re_freq_unit.
- Return type:
np.rec.array
- class wsssss.load_data.GyreMode(path, keep_columns='all', gyre_version='7', save_dill=False, reload=False, verbose=False, nanval=-1e+99, nanclip=None)
Bases:
_Gyre- __init__(path, keep_columns='all', gyre_version='7', save_dill=False, reload=False, verbose=False, nanval=-1e+99, nanclip=None)
Common methods and attributes for GyreSummary and GyreMode.
- Parameters:
path (str) – Path to the Gyre summary or mode data file. If ending with .dill, will strip it and set that as path.
keep_columns (list of str, optional) – Which columns of the history data file to keep.
gyre_version (str) – Gyre version.
save_dill (bool, optional) – If True, will write a .dill file containing the History data.
reload (bool, optional) – If True, will ignore a pre-existing .dill file and reload from the history file.
verbose (bool, optional) – Print extra information.
nanval (float, optional) – Set all values equal to this to NaN.
nanclip (2 floats, optional) – Set all values outside this range to NaN.
- _dimless_to_Hz()
- Returns:
Conversion factor between dimensionless frequency and Hz.
- Return type:
float
- get_frequencies(freq_units)
Get frequencies in the specicied units. Will use ‘Re(omega)’ first and ‘Re(freq)’ otherwise. :param freq_units: Unit to convert to, must be one of ‘uHz’, ‘mHz’, or ‘Hz’. :type freq_units: str :param Re_freq_unit: Unit of the ‘Re(freq)’ column, must be one of ‘uHz’, ‘mHz’, or ‘Hz’. :type Re_freq_unit: str, optional
- Returns:
Frequencies in unit specified by Re_freq_unit.
- Return type:
np.rec.array
- class wsssss.load_data.GyreProfile(path)
Bases:
object- __init__(path)
Gyre profile created by MESA.
- Parameters:
path – Path to gyre profile file.
- data = None
- wsssss.load_data.load_profs(hist, prefix='profile', suffix='.data', save_dill=False, mask=None, mask_kwargs=None)
Load profiles associated with History hist.
- Parameters:
hist (History)
prefix (str, optional) – Part of profile name before the profile number. Defaults to ‘profile’.
suffix (str, optional) – Part of profile name after the profile number. Defaults to ‘.data’.
save_dill (bool, optional) – If True, will write a .dill file containing the History data.
mask (array of bool or function) – Mask to apply to column(s).
mask_kwargs (dict, optional) – kwargs to pass to mask if it is a function.
- Returns:
All profiles in hist.index or those which satisfy mask.
- Return type:
list of Profile
- wsssss.load_data.load_gss(hist, gyre_data_dir='gyre_out', gyre_summary_prefix='profile', gyre_summary_suffix='.data.GYRE.sgyre_l', return_pnums=False, use_mask=None, keep_columns='all', gyre_version='7', save_dill=False, reload=False, verbose=False, nanval=-1e+99, nanclip=None)
Load GyreSummary associated with History hist.
- Parameters:
hist
gyre_data_dir – Directory containing gyre summary files.
gyre_summary_prefix (str, optional) – Part of gyre summary name before the profile number. Defaults to ‘profile’.
gyre_summary_suffix (str, optional) – Part of gyre summary name after the profile number. Defaults to ‘.data.GYRE.sgyre_l’.
return_pnums (bool, optional) – Defaults to False. If True, will also return profile numbers.
use_mask (bool, np.array, or function, optional) – If True, will exclude pre-main sequence. If an array of bools will use that as mask. If a function, will call function(hist) and use that as the mask.
keep_columns (list of str, optional) – Which columns of the history data file to keep.
gyre_version (str) – Gyre version.
save_dill (bool, optional) – If True, will write a .dill file containing the GyreSummary data.
reload (bool, optional) – If True, will ignore a pre-existing .dill file and reload from the gyre summary file.
verbose (bool, optional) – Print extra information.
nanval (float, optional) – Set all values equal to this to NaN.
nanclip (2 floats, optional) – Set all values outside this range to NaN.
- Returns:
- If return_pnums is False returns only GyreSummary.
If return_pnums is True also return profile numbers.
- Return type:
list of GyreSummary or list of list of GyreSummary
- wsssss.load_data.load_modes_from_profile(prof, gyre_data_dir='gyre_out', mode_prefix='', mode_suffix='.mgyre', keep_columns='all', gyre_version='7', save_dill=False, reload=False, verbose=False, nanval=-1e+99, nanclip=None)
Load all GyreMode associated with Profile prof.
- Parameters:
prof
gyre_data_dir – Directory containing gyre summary files.
mode_prefix (str, optional) – First part of the mode filename. If an empty string will use the profile name. Defaults to ‘’.
mode_suffix (str, optional) – Last part of the gyre mode filename. Defaults to ‘.mgyre’.
keep_columns (list of str, optional) – Which columns of the mode data file to keep.
gyre_version (str) – Gyre version.
save_dill (bool, optional) – If True, will write a .dill file containing the GyreMode data.
reload (bool, optional) – If True, will ignore a pre-existing .dill file and reload from the mode file.
verbose (bool, optional) – Print extra information.
nanval (float, optional) – Set all values equal to this to NaN.
nanclip (2 floats, optional) – Set all values outside this range to NaN.
- Return type:
list of GyreMode
- wsssss.load_data.load_gs_from_profile(prof, gyre_data_dir='gyre_out', gyre_summary_prefix='', gyre_summary_suffix='.data.GYRE.sgyre_l', keep_columns='all', gyre_version='7', save_dill=False, reload=False, verbose=False, nanval=-1e+99, nanclip=None)
Load the GyreSummary associated with Profile prof.
- Parameters:
prof (Profile)
gyre_data_dir – Directory containing gyre summary files.
gyre_summary_prefix (str, optional) – First part of gyre summary name. First part of the gyre summary filename. If an empty string will use the profile name. Defaults to ‘’.
gyre_summary_suffix (str, optional) – Part of gyre summary name after the profile number. Defaults to ‘.data.GYRE.sgyre_l’.
keep_columns (list of str, optional) – Which columns of the history data file to keep.
gyre_version (str) – Gyre version.
save_dill (bool, optional) – If True, will write a .dill file containing the History data.
reload (bool, optional) – If True, will ignore a pre-existing .dill file and reload from the history file.
verbose (bool, optional) – Print extra information.
nanval (float, optional) – Set all values equal to this to NaN.
nanclip (2 floats, optional) – Set all values outside this range to NaN.
- Return type:
- wsssss.load_data.naive_merge_hists(base_hist, hists)
Merge two History objects. This function simply stacks the history data onto a new copy of base_hist.
- wsssss.load_data.load_gss_to_hist(hist, gyre_data_dir='gyre_out', gyre_summary_prefix='profile', gyre_summary_suffix='.data.GYRE.sgyre_l', use_mask=None, keep_columns='all', gyre_version='7', save_dill=False, reload=False, verbose=False, nanval=-1e+99, nanclip=None)
Load
GyreSummaryand profile numbers associated withHistoryhist and place in the attributeHistory.gsspnum. This is equivalent to doinghist.gsspnum = load_gss(..., return_pnums=True, ...).- Parameters:
hist
gyre_data_dir – Directory containing gyre summary files.
gyre_summary_prefix (str, optional) – Part of gyre summary name before the profile number. Defaults to ‘profile’.
gyre_summary_suffix (str, optional) – Part of gyre summary name after the profile number. Defaults to ‘.data.GYRE.sgyre_l’.
use_mask (bool, np.array, or function, optional) – If True, will exclude pre-main sequence. If an array of bools will use that as mask. If a function, will call function(hist) and use that as the mask.
keep_columns (list of str, optional) – Which columns of the history data file to keep.
gyre_version (str) – Gyre version.
save_dill (bool, optional) – If True, will write a .dill file containing the GyreSummary data.
reload (bool, optional) – If True, will ignore a pre-existing .dill file and reload from the gyre summary file.
verbose (bool, optional) – Print extra information.
nanval (float, optional) – Set all values equal to this to NaN.
nanclip (2 floats, optional) – Set all values outside this range to NaN.
- Returns:
- If return_pnums is False returns only GyreSummary.
If return_pnums is True also return profile numbers.
- Return type:
list of GyreSummary or list of list of GyreSummary