tardis.util.base module¶
- tardis.util.base.atomic_number2element_symbol(atomic_number)[source]¶
 Convert atomic number to string
- Parameters
 - atomic_numberint
 Inputted atomic number
- Returns
 - str
 Returned corresponding element symbol
- tardis.util.base.calculate_luminosity(spec_fname, distance, wavelength_column=0, wavelength_unit=Unit('Angstrom'), flux_column=1, flux_unit=Unit('erg / (Angstrom cm2 s)'))[source]¶
 Calculates luminosity of star.
- Parameters
 - spec_fnamefile or str
 File or file name to be read
- distancefloat
 Distance to star
- wavelength_columnint, optional(default = 0)
 Column index in which the wavelength is stored
- wavelength_unitfloat, optional(default = u.angstrom)
 Dictates units used for calculating wavelength.
- flux_columnint, optional(default = 1)
 Column index in which the flux is stored
- flux_unitstr, optional(default = u.Unit(‘erg / (Angstrom cm2 s)’)
 Dictates units used for flux
- Returns
 - luminosity.valuefloat
 Returned luminosity value of star.
- wavelength.min()float
 Minimum value of wavelength of light
- wavelength.max()float
 Maximum value of wavelength of light
- tardis.util.base.convert_abundances_format(fname, delimiter='\\s+')[source]¶
 Changes format of file containing abundances into data frame
- Parameters
 - fnamefile, str
 File or file name that contains abundance info
- delimiterstr, optional(default = ‘s+’)
 Determines the separator for splitting file
- Returns
 - DataFrame
 Corresponding data frame
- tardis.util.base.create_synpp_yaml(radial1d_mdl, fname, shell_no=0, lines_db=None)[source]¶
 Create a yaml file that is readable from syn++
- Parameters
 - radial1d_mdlRadial1DModel
 Inputted object that will be read into YAML file
- fnamestr
 File name for the synpp yaml
- shell_noint, optional(default = 0)
 Number of shells
- lines_dbfile, optional(default = None)
 
- Raises
 - ValueError
 If the current dataset does not contain necessary reference files
- tardis.util.base.element_symbol2atomic_number(element_string)[source]¶
 Takes an element symbol and returns its corresponding atomic number
- Parameters
 - element_stringstr
 Inputted element symbol
- Returns
 - int
 Returned atomic number
- tardis.util.base.int_to_roman(i)[source]¶
 Convert an integer into its roman numeral representation.
- Parameters
 - iint
 Integer to be converted into roman numerals
- Returns
 - str
 Returns roman numeral representation of i in str format.
- tardis.util.base.intensity_black_body(nu, T)[source]¶
 Calculate the intensity of a black-body according to the following formula
\[I(\nu, T) = \frac{2h\nu^3}{c^2}\frac{1} {e^{h\nu \beta_\textrm{rad}} - 1}\]- Parameters
 - nufloat
 Frequency of light
- Tfloat
 Temperature in kelvin
- Returns
 - Intensityfloat
 Returns the intensity of the black body
- tardis.util.base.is_notebook()[source]¶
 Checking the shell environment where the simulation is run is Jupyter based
- Returns
 - Trueif the shell environment is IPython Based
 - Falseif the shell environment is Terminal or anything else
 
- tardis.util.base.parse_quantity(quantity_string)[source]¶
 Changes a string into it’s corresponding astropy.Quantity object.
- Parameters
 - quantity_stringstr
 String to be converted into astropy.Quantity
- Returns
 - qu.Quantity
 Corresponding astropy.Quantity object for passed string
- Raises
 - MalformedQuantityError
 If string is not properly formatted for Astropy Quantity
- tardis.util.base.quantity_linspace(start, stop, num, **kwargs)[source]¶
 Essentially the same input parameters as linspace, but calculated for an astropy quantity start and stop.
- Parameters
 - startastropy.Quantity
 Starting value of the sequence
- stopastropy.Quantity
 End value of the sequence
- numint
 Number of samples to generate
- Returns
 - astropy.Quantity
 Returns num evenly spaced characters of type astropy.Quantity
- Raises
 - ValueError
 If start and stop values have no unit attribute.
- tardis.util.base.reformat_element_symbol(element_string)[source]¶
 - Reformat the string so the first letter is uppercase and all subsequent
 letters lowercase.
- Parameters
 - element_stringstr
 Inputted element symbol
- Returns
 - str
 Returned reformatted element symbol
- tardis.util.base.roman_to_int(roman_string)[source]¶
 Convert a roman numeral into its corresponding integer.
- Parameters
 - roman_stringstr
 Roman numeral to be converted into an integer
- Returns
 - int
 Returns integer representation of roman_string
- tardis.util.base.species_string_to_tuple(species_string)[source]¶
 Convert a species string to its corresponding tuple representation
- Parameters
 - species_stringstr
 String containing species symbol (e.g. Si II, Fe III)
- Returns
 - atomic_number, ion_numbertuple
 Returns tuple of length 2 indicating atomic number and ion number
- Raises
 - MalformedSpeciesError
 If the inputted string does not match the species format
- tardis.util.base.species_tuple_to_string(species_tuple, roman_numerals=True)[source]¶
 Convert a species tuple to its corresponding string representation.
- Parameters
 - species_tupletuple
 Tuple of 2 values indicated atomic number and number of electrons missing
- roman_numeralsbool, optional(default = TRUE)
 Indicates whether the returned ion number is in roman numerals
- Returns
 - element_symbol, roman_ion_numberstr
 Returns corresponding string representation of given tuple