Various utility functions used for the manipulating grid data.
- posydon.utils.gridutils.T_merger_P(P, m1, m2)[source]
Merger time given initial orbital period and masses of binary.
- posydon.utils.gridutils.T_merger_a(a, m1, m2)[source]
Merger time given initial orbital separation and masses of binary.
- posydon.utils.gridutils.add_field(a, descr)[source]
Return a new array that is like a, but has additional fields.
The contents of a are copied over to the appropriate fields in the new array, whereas the new fields are uninitialized. The arguments are not modified.
- Parameters
a (structured numpy array) – The base array.
descr (str) – A numpy type description of the new fields.
- Returns
Description of returned object.
- Return type
Example
>>> sa = numpy.array([(1, 'Foo'), (2, 'Bar')], dtype=[('id', int), ('name', 'S3')]) >>> sa.dtype.descr == numpy.dtype([('id', int), ('name', 'S3')]) True >>> sb = add_field(sa, [('score', float)]) >>> sb.dtype.descr == numpy.dtype([('id', int), ('name', 'S3'), ('score', float)]) True >>> numpy.all(sa['id'] == sb['id']) True >>> numpy.all(sa['name'] == sb['name']) True
- posydon.utils.gridutils.beta_gw(m1, m2)[source]
Evaluate the “beta” (equation 5.9) from Peters (1964).
- posydon.utils.gridutils.clean_inlist_file(inlist, **kwargs)[source]
Get dictionary of possible parameters/values from the default inlist.
- posydon.utils.gridutils.convert_output_to_table(output_file, binary_history_file=None, star1_history_file=None, star2_history_file=None, column_names=['result', 'CE_flag', 'M_1f(Msun)', 'M_2f(Msun)', 'Porb_f(d)', 'tmerge(Gyr)', 'log_L_1', 'log_T_1', 'He_core_1(Msun)', 'C_core_1(Msun)', 'log_L_2', 'log_T_2', 'He_core_2(Msun)', 'C_core_2(Msun)'])[source]
Convert output of a run, to a pandas dataframe.
- Parameters
- Returns
The table containing the requested columns from the run’s histories.
- Return type
pandas dataframe
- posydon.utils.gridutils.find_index_nearest_neighbour(array, value)[source]
Find the index of array closest to the value.
- posydon.utils.gridutils.find_nearest(val, array)[source]
Find the element of array closest to the value val.
- posydon.utils.gridutils.fix_He_core(history)[source]
Make He core mass/radius at least equal to CO core mass/radius.
- posydon.utils.gridutils.get_cell_edges(grid_x, grid_y)[source]
Return the edges of grid cells to be used for plotting with pcolormesh.
- Parameters
grid_x (array) – Center values of grid cells for X.
grid_y (array) – Center values of grid cells for Y.
- Returns
array – X grid values.
array – Y grid values.
- posydon.utils.gridutils.get_final_proposed_points(proposed_x, grid_x, proposed_y, grid_y)[source]
Map proposed simulation points to the center of a correspoding cell.
Only one mapped value is returned if more than one proposed point falls within one cell.
- Parameters
proposed_x (array) – Proposed points for X.
grid_x (array) – The values of X at the center of the grid cells.
proposed_y (array) – Proposed points for Y.
grid_y (type) – The values of Y at the center of the grid cells.
- Returns
array – Mapped X values.
array – Mapped Y values.
- posydon.utils.gridutils.join_lists(A, B)[source]
Make a joint list of A and B without repetitions and keeping the order.
- Parameters
A (iterable) – The baseline list to be extended.
B (iterable) – The second list from which additional elements will be appened.
- Returns
The joint list by merging A and B.
- Return type
- posydon.utils.gridutils.kepler3_a(P, m1, m2)[source]
Calculate the semimajor axis of a binary from its period and masses.
- posydon.utils.gridutils.read_EEP_data_file(path, columns)[source]
Read an EEP file - similar to read_MESA_data_file().