Extend astropy.table
with the KNTable
-
class
gwemlightcurves.KNModels.table.
KNTable
(data=None, masked=None, names=None, dtype=None, meta=None, copy=True, rows=None, copy_indices=True, **kwargs)[source]¶ Bases:
astropy.table.table.Table
A container for a table of events
See also
astropy.table.Table
- for details on parameters for creating an KNTable
Attributes
ColumnClass
colnames
dtype
groups
has_mixin_columns
True if table has any mixin columns (defined as columns that are not Column iloc
Return a TableILoc object that can be used for retrieving indexed rows in the order they appear in the index. indices
Return the indices associated with columns of the table as a TableIndices object. loc
Return a TableLoc object that can be used for retrieving rows by index in a given data range. mask
masked
Methods
Column
Define a data column for use in a Table object. MaskedColumn
Define a masked data column for use in a Table object. Row
(table, index)A class to represent one row of a Table object. TableColumns
([cols])OrderedDict subclass for a set of columns. TableFormatter
add_column
(col[, index, rename_duplicate])Add a new Column object col
to the table.add_columns
(cols[, indexes, copy, …])Add a list of new Column objects cols
to the table.add_index
(colnames[, engine, unique])Insert a new index among one or more columns. add_row
([vals, mask])Add a new row to the end of the table. argsort
([keys, kind])Return the indices which would sort the table according to one or more key columns. as_array
([keep_byteorder])Return a new copy of the table in the form of a structured np.ndarray or np.ma.MaskedArray object (as appropriate). calc_baryonic_mass
(EOS, TOV[, fit])if fit=True then the fit from calc_compactness
([fit])calculate compactness of objects from lambda1 and lambda2 calc_radius
(EOS, TOV)calc_tidal_lambda
([remove_negative_lambda])Takes posterior samples and calculates lambda1 and lambda2 from lambdat and dlambdat. convert_bytestring_to_unicode
([python3_only])Convert bytestring columns (dtype.kind=’S’) to unicode (dtype.kind=’U’) assuming ASCII encoding. convert_unicode_to_bytestring
([python3_only])Convert ASCII-only unicode columns (dtype.kind=’U’) to bytestring (dtype.kind=’S’). copy
([copy_data])Return a copy of the table. downsample
([Nsamples])randomly down samples the number os posterior samples used for calculating lightcurves field
(item)Return column[item] for recarray compatibility. filled
([fill_value])Return a copy of self, with masked values filled. from_pandas
(dataframe)Create a Table from a pandas.DataFrame
instancegroup_by
(keys)Group this table by the specified keys
index_column
(name)Return the positional index of column name
.index_mode
(mode)Return a context manager for an indexing mode. info
insert_row
(index[, vals, mask])Add a new row before the given index
position in the table.itercols
()Iterate over the columns of this table. keep_columns
(names)Keep only the columns specified (remove the others). keys
()mass_cut
([mass1, mass2, mtotmin, mtotmax])Perform mass cut on table. model
(format_, *args, **kwargs)Fetch a table of events from a database more
([max_lines, max_width, show_name, …])Interactively browse table with a paging interface. pformat
([max_lines, max_width, show_name, …])Return a list of lines for the formatted string representation of the table. plot_mag_panels
(table_dict, distance[, …])This allows us to take the lightcurves from the KNModels samples table and plot it using a supplied set of filters. pprint
([max_lines, max_width, show_name, …])Print a formatted string representation of the table. read
(*args, **kwargs)Read and parse a data table and return as a Table. read_samples
(filename_samples)Read LALinference posterior_samples remove_column
(name)Remove a column from the table. remove_columns
(names)Remove several columns from the table. remove_indices
(colname)Remove all indices involving the given column. remove_row
(index)Remove a row from the table. remove_rows
(row_specifier)Remove rows from the table. rename_column
(name, new_name)Rename a column. replace_column
(name, col)Replace column name
with the newcol
object.reverse
()Reverse the row order of table rows. show_in_browser
([max_lines, jsviewer, …])Render the table in HTML and show it in a web browser. show_in_notebook
([tableid, css, …])Render the table in HTML and show it in the IPython notebook. sort
([keys])Sort the table according to one or more keys. to_pandas
()Return a pandas.DataFrame
instancewrite
(*args, **kwargs)Write this Table object out in the specified format. -
calc_baryonic_mass
(EOS, TOV, fit=False)[source]¶ if fit=True then the fit from Equation to relate EOS and neutron star mass to Baryonic mass Eq 8: https://arxiv.org/pdf/1708.07714.pdf
-
calc_tidal_lambda
(remove_negative_lambda=False)[source]¶ Takes posterior samples and calculates lambda1 and lambda2 from lambdat and dlambdat.
-
downsample
(Nsamples=100)[source]¶ randomly down samples the number os posterior samples used for calculating lightcurves plotting etc
-
classmethod
model
(format_, *args, **kwargs)[source]¶ Fetch a table of events from a database
Parameters: *args
all other positional arguments are specific to the data format, see below for basic usage
**kwargs
all other positional arguments are specific to the data format, see the online documentation for more details
Returns: table : KNTable
a table of events recovered from the remote database
Notes
The available named formats are:
Format Basic usage BaKa2016 model('BaKa2016', table)
DiUj2017 model('DiUj2017', table)
Ka2017 model('Ka2017', table)
KaKy2016 model('KaKy2016', table)
Me2017 model('Me2017', table)
RoFe2017 model('RoFe2017', table)
SmCh2017 model('SmCh2017', table)
WoKo2017 model('WoKo2017', table)
-
classmethod
plot_mag_panels
(table_dict, distance, filts=['g', 'r', 'i', 'z', 'y', 'J', 'H', 'K'], magidxs=[0, 1, 2, 3, 4, 5, 6, 7, 8], figsize=(20, 28))[source]¶ This allows us to take the lightcurves from the KNModels samples table and plot it using a supplied set of filters. Default: filts=[“g”,”r”,”i”,”z”,”y”,”J”,”H”,”K”]
-
gwemlightcurves.KNModels.table.
tidal_lambda_from_tilde
(mass1, mass2, lam_til, dlam_til)[source]¶ Determine physical lambda parameters from effective parameters. See Eqs. 5 and 6 from https://journals.aps.org/prd/pdf/10.1103/PhysRevD.89.103012
-
gwemlightcurves.KNModels.table.
CLove
(lmbda)[source]¶ Compactness-Love relation for neutron stars from Eq. (78) of Yagi and Yunes, Phys. Rep. 681, 1 (2017), using the YY coefficients and capping the compactness at the Buchdahl limit of 4/9 = 0.44… (since the fit diverges as lambda o 0). We also cap the compactness at zero, since it becomes negative for large lambda, though these lambdas are so large that they are unlikely to be encountered in practice. In both cases, we raise an error if it runs up against either of the bounds.
Input: Dimensionless quadrupolar tidal deformability lmbda Output: Compactness (mass over radius, in geometrized units, so the result is dimensionless)
-
gwemlightcurves.KNModels.table.
EOSfit
(mns, c)[source]¶ # Equation to relate EOS and neutron star mass to Baryonic mass # Eq 8: https://arxiv.org/pdf/1708.07714.pdf
-
gwemlightcurves.KNModels.table.
get_eos_list
(TOV)[source]¶ Populates lists of available EOSs for each set of TOV solvers