vice.core.dataframe.fromfile¶
The VICE dataframe: derived class (inherits from base)
Provides a means of storing and accessing generic simulation output. Fromfile objects are created by various functions which read in simulation output (e.g. vice.mdf).
Attributes¶
- name
str
The name of the file that the data was pulled from.
- size
tuple
Contains two integers: the (length, width) of the data.
Allowed Data Types¶
- Keys
str
[case-insensitive]the physical quantityA name given to the physical quantity to take from or store with the output.
Note
VICE automatically assigns keys to quantities in the output which cannot be overridden.
- Values
- array-like
Must have the same length as the values of the dataframe obtained from the output file.
Indexing¶
int
: A given line-number of the output. Returns a dataframe with the same keys, but whose values are taken only from the specified line of output.str
[case-insensitive] : labels of the lists of quantities stored.For MDF objects, the following are assigned automatically by VICE when reading in the output and will not be re-assigned:
‘bin_edge_left’ : Lower bin edges of the distribution
‘bin_edge_right’ : Upper bin edges of the distribution
‘dn/d[x/h]’ : The value of the probability distribution function of stars in their [X/H] logarithmic abundance.
‘dn/d[x/y]’ : The value of the probability distribution function of stars in their [X/Y] logarithmic abundance ratio.
Functions¶
keys
todict
filter
Example Code¶
>>> import vice
>>> example = vice.mdf("example")
>>> example.keys()
['bin_edge_left',
'bin_edge_right',
'dn/d[fe/h]',
'dn/d[sr/h]',
'dn/d[o/h]',
'dn/d[sr/fe]',
'dn/d[o/fe]',
'dn/d[o/sr]']
>>> example["bin_edge_left"][:10]
[-3.0, -2.95, -2.9, -2.85, -2.8, -2.75, -2.7, -2.65, -2.6, -2.55]
>>> example[60]
vice.dataframe{
bin_edge_left --> 0.0
bin_edge_right -> 0.05
dn/d[fe/h] -----> 0.0
dn/d[sr/h] -----> 0.0
dn/d[o/h] ------> 0.0
dn/d[sr/fe] ----> 0.06001488
dn/d[o/fe] -----> 0.4337209
dn/d[o/sr] -----> 0.0
}
Signature: vice.core.dataframe.fromfile(filename = None, labels = None, adopted_solar_z = None)
Warning
Users should avoid creating new instances of derived classes of the VICE dataframe. Fromfile objects are created by various functions which read in simulation output (e.g. vice.mdf).
Parameters¶
- filename
str
[defaultNone] The name of the ascii file containing the output.
- list
list
of strings [defaultNone] The strings to assign the column labels.
- adopted_solar_zreal number [defaultNone]
The metallicity by mass of the sun \(Z_\odot\) adopted in the simulation.