mcfacts.objects.agnobject.AGNBinaryBlackHole

class mcfacts.objects.agnobject.AGNBinaryBlackHole(mass_1=array([], dtype=float64), mass_2=array([], dtype=float64), orb_a_1=array([], dtype=float64), orb_a_2=array([], dtype=float64), spin_1=array([], dtype=float64), spin_2=array([], dtype=float64), spin_angle_1=array([], dtype=float64), spin_angle_2=array([], dtype=float64), bin_sep=array([], dtype=float64), bin_orb_a=array([], dtype=float64), time_to_merger_gw=array([], dtype=float64), flag_merging=array([], dtype=float64), time_merged=array([], dtype=float64), bin_ecc=array([], dtype=float64), gen_1=array([], dtype=float64), gen_2=array([], dtype=float64), bin_orb_ang_mom=array([], dtype=float64), bin_orb_inc=array([], dtype=float64), bin_orb_ecc=array([], dtype=float64), gw_freq=array([], dtype=float64), gw_strain=array([], dtype=float64), galaxy=array([], dtype=float64), bin_bh_num=0, id_num=array([], dtype=float64))

Bases: AGNObject

An array of binary black holes. Should include all objects of this type. No other objects should contain objects of this type.

Create an instance of AGNBinaryBlackHole

Parameters:
  • mass_1 (numpy array) – mass of object 1 in Msun

  • mass_2 (numpy array) – mass of object 2 in Msun

  • orb_a_1 (numpy array) – orbital semi-major axis of object 1 wrt SMBH in R_g

  • orb_a_2 (numpy array) – orbital semi-major axis of object 2 wrt SMBH in R_g

  • spin_1 (numpy array) – dimensionless spin magnitude of object 1

  • spin_2 (numpy array) – dimensionless spin magnitude of object 2

  • spin_angle_1 (numpy array) – spin angle of object 1 wrt disk gas in radians

  • spin_angle_2 (numpy array) – spin angle of object 2 wrt disk gas in radians

  • bin_sep (numpy array) – separation of binary in R_g (semi-major axis around center of mass)

  • bin_orb_a (numpy array) – semi-major axis of the binary’s center of mass wrt SMBH in R_g (location in disk)

  • time_to_merger_gw (numpy array) – time until binary will merge through GW alone

  • flag_merging (numpy array of ints) – flag for if binary is merging this timestep (-2 if merging, 0 else)

  • time_merged (numpy array) – time the binary merged (for things that already merged)

  • bin_ecc (numpy array) – eccentricity of the binary around the center of mass

  • gen_1 (numpy array of ints) – generation of object 1 (1 = natal black hole, no prior mergers)

  • gen_2 (numpy array of ints) – generation of object 2 (1 = natal black hole, no prior mergers)

  • bin_orb_ang_mom (numpy array) – angular momentum of the binary wrt SMBH (+1 prograde / -1 retrograde)

  • bin_orb_inc (numpy array) – orbital inclination of the binary wrt SMBH

  • bin_orb_ecc (numpy array) – orbital eccentricity of the binary wrt SMBH

  • gw_freq (numpy array) – GW frequency of binary nu_gw = 1./pi * sqrt(G * M_bin / bin_sep^3)

  • gw_strain (numpy array) – GW strain of binary h = (4/d_obs) *(GM_chirp/c^2)*(pi*nu_gw*GM_chirp/c^3)^(2/3) where m_chirp =(M_1 M_2)^(3/5) /(M_bin)^(1/5) For local distances, approx d=cz/H0 = 3e8m/s(z)/70km/s/Mpc =3.e8 (z)/7e4 Mpc =428 Mpc assume 1Mpc = 3.1e22m. From Ned Wright’s calculator (https://www.astro.ucla.edu/~wright/CosmoCalc.html) (z=0.1)=421Mpc. (z=0.5)=1909 Mpc

  • id_num (numpy array) – unique ID numbers

  • bin_bh_num (int) – number of binaries

__init__(mass_1=array([], dtype=float64), mass_2=array([], dtype=float64), orb_a_1=array([], dtype=float64), orb_a_2=array([], dtype=float64), spin_1=array([], dtype=float64), spin_2=array([], dtype=float64), spin_angle_1=array([], dtype=float64), spin_angle_2=array([], dtype=float64), bin_sep=array([], dtype=float64), bin_orb_a=array([], dtype=float64), time_to_merger_gw=array([], dtype=float64), flag_merging=array([], dtype=float64), time_merged=array([], dtype=float64), bin_ecc=array([], dtype=float64), gen_1=array([], dtype=float64), gen_2=array([], dtype=float64), bin_orb_ang_mom=array([], dtype=float64), bin_orb_inc=array([], dtype=float64), bin_orb_ecc=array([], dtype=float64), gw_freq=array([], dtype=float64), gw_strain=array([], dtype=float64), galaxy=array([], dtype=float64), bin_bh_num=0, id_num=array([], dtype=float64))

Create an instance of AGNBinaryBlackHole

Parameters:
  • mass_1 (numpy array) – mass of object 1 in Msun

  • mass_2 (numpy array) – mass of object 2 in Msun

  • orb_a_1 (numpy array) – orbital semi-major axis of object 1 wrt SMBH in R_g

  • orb_a_2 (numpy array) – orbital semi-major axis of object 2 wrt SMBH in R_g

  • spin_1 (numpy array) – dimensionless spin magnitude of object 1

  • spin_2 (numpy array) – dimensionless spin magnitude of object 2

  • spin_angle_1 (numpy array) – spin angle of object 1 wrt disk gas in radians

  • spin_angle_2 (numpy array) – spin angle of object 2 wrt disk gas in radians

  • bin_sep (numpy array) – separation of binary in R_g (semi-major axis around center of mass)

  • bin_orb_a (numpy array) – semi-major axis of the binary’s center of mass wrt SMBH in R_g (location in disk)

  • time_to_merger_gw (numpy array) – time until binary will merge through GW alone

  • flag_merging (numpy array of ints) – flag for if binary is merging this timestep (-2 if merging, 0 else)

  • time_merged (numpy array) – time the binary merged (for things that already merged)

  • bin_ecc (numpy array) – eccentricity of the binary around the center of mass

  • gen_1 (numpy array of ints) – generation of object 1 (1 = natal black hole, no prior mergers)

  • gen_2 (numpy array of ints) – generation of object 2 (1 = natal black hole, no prior mergers)

  • bin_orb_ang_mom (numpy array) – angular momentum of the binary wrt SMBH (+1 prograde / -1 retrograde)

  • bin_orb_inc (numpy array) – orbital inclination of the binary wrt SMBH

  • bin_orb_ecc (numpy array) – orbital eccentricity of the binary wrt SMBH

  • gw_freq (numpy array) – GW frequency of binary nu_gw = 1./pi * sqrt(G * M_bin / bin_sep^3)

  • gw_strain (numpy array) – GW strain of binary h = (4/d_obs) *(GM_chirp/c^2)*(pi*nu_gw*GM_chirp/c^3)^(2/3) where m_chirp =(M_1 M_2)^(3/5) /(M_bin)^(1/5) For local distances, approx d=cz/H0 = 3e8m/s(z)/70km/s/Mpc =3.e8 (z)/7e4 Mpc =428 Mpc assume 1Mpc = 3.1e22m. From Ned Wright’s calculator (https://www.astro.ucla.edu/~wright/CosmoCalc.html) (z=0.1)=421Mpc. (z=0.5)=1909 Mpc

  • id_num (numpy array) – unique ID numbers

  • bin_bh_num (int) – number of binaries

Methods

__init__([mass_1, mass_2, orb_a_1, orb_a_2, ...])

Create an instance of AGNBinaryBlackHole

add_binaries([new_mass_1, new_mass_2, ...])

Creates an instance of the AGNBinaryBlackHole class.

add_objects([new_mass, new_spin, ...])

Append new objects to the AGNObject.

at_id_num(id_num[, attr])

Returns the attribute at the specified ID numbers

check_consistency()

Prints the size of each attribute to check that everything is consistent.

copy()

Creates a deep copy of the AGNObject

init_from_file([fname])

Reads in file from previous AGNObject.

keep_id_num(id_num_keep)

Filters AGNObject to only keep the objects at the specified ID numbers

keep_index(idx_keep)

Filters AGNObject to only keep the objects at the specified indices.

remove_id_num([id_num_remove])

Filters AGNObject to remove the objects at the specified ID numbers

remove_index([idx_remove])

Removes objects at specified indices.

return_params()

Gets list of parameters present in object.

return_record_array()

Returns a numpy dictionary of all attributes in the AGNObject

sort([sort_attr])

Sorts all attributes of the AGNObject by the passed attribute

to_txt([fname, cols, extra_header])

Loads AGNObject into temporary multi-dim numpy array and then uses np.savetxt to save to file.

unique_id_nums()

Checks that ID numbers are unique.

Attributes

mass_total

Return the total mass

add_binaries(new_mass_1=array([], dtype=float64), new_mass_2=array([], dtype=float64), new_orb_a_1=array([], dtype=float64), new_orb_a_2=array([], dtype=float64), new_spin_1=array([], dtype=float64), new_spin_2=array([], dtype=float64), new_spin_angle_1=array([], dtype=float64), new_spin_angle_2=array([], dtype=float64), new_bin_sep=array([], dtype=float64), new_bin_orb_a=array([], dtype=float64), new_time_to_merger_gw=array([], dtype=float64), new_flag_merging=array([], dtype=float64), new_time_merged=array([], dtype=float64), new_bin_ecc=array([], dtype=float64), new_gen_1=array([], dtype=float64), new_gen_2=array([], dtype=float64), new_bin_orb_ang_mom=array([], dtype=float64), new_bin_orb_inc=array([], dtype=float64), new_bin_orb_ecc=array([], dtype=float64), new_gw_freq=array([], dtype=float64), new_gw_strain=array([], dtype=float64), new_id_num=array([], dtype=float64), new_galaxy=array([], dtype=float64), new_bin_bh_num=0)

Creates an instance of the AGNBinaryBlackHole class.

Parameters:
  • new_mass_1 (numpy array) – mass of object 1 in Msun

  • new_mass_2 (numpy array) – mass of object 2 in Msun

  • new_orb_a_1 (numpy array) – orbital semi-major axis of object 1 wrt SMBH in R_g

  • new_orb_a_2 (numpy array) – orbital semi-major axis of object 2 wrt SMBH in R_g

  • new_spin_1 (numpy array) – dimensionless spin magnitude of object 1

  • new_spin_2 (numpy array) – dimensionless spin magnitude of object 2

  • new_spin_angle_1 (numpy array) – spin angle of object 1 wrt disk gas in radians

  • new_spin_angle_2 (numpy array) – spin angle of object 2 wrt disk gas in radians

  • new_bin_sep (numpy array) – separation of binary in R_g (semi-major axis around center of mass)

  • new_bin_orb_a (numpy array) – semi-major axis of the binary’s center of mass wrt SMBH in R_g (location in disk)

  • new_time_to_merger_gw (numpy array) – time until binary will merge through GW alone

  • new_flag_merging (numpy array of ints) – flag for if binary is merging this timestep (-2 if merging, 0 else)

  • new_time_merged (numpy array) – time the binary merged (for things that already merged)

  • new_bin_ecc (numpy array) – eccentricity of the binary around the center of mass

  • new_gen_1 (numpy array of ints) – generation of object 1 (1 = natal black hole, no prior mergers)

  • new_gen_2 (numpy array of ints) – generation of object 2 (1 = natal black hole, no prior mergers)

  • new_bin_orb_ang_mom (numpy array) – angular momentum of the binary wrt SMBH (+1 prograde / -1 retrograde)

  • new_bin_orb_inc (numpy array) – orbital inclination of the binary wrt SMBH

  • new_bin_orb_ecc (numpy array) – orbital eccentricity of the binary wrt SMBH

  • new_gw_freq (numpy array) – GW frequency of binary

  • new_gw_strain (numpy array) – GW strain of binary

  • new_id_num (numpy array) – unique ID numbers

  • new_bin_bh_num (int) – number of binaries to add

add_objects(new_mass=array([], dtype=float64), new_spin=array([], dtype=float64), new_spin_angle=array([], dtype=float64), new_orb_a=array([], dtype=float64), new_orb_inc=array([], dtype=float64), new_orb_ang_mom=array([], dtype=float64), new_orb_ecc=array([], dtype=float64), new_orb_arg_periapse=array([], dtype=float64), new_gen=array([], dtype=float64), new_galaxy=array([], dtype=float64), new_time_passed=array([], dtype=float64), new_id_num=array([], dtype=float64), obj_num=0)

Append new objects to the AGNObject. This method is not called directly, it is only called by the subclasses’ add methods.

Parameters:
  • new_mass (numpy array) – masses to be added

  • new_spin (numpy array) – spins to be added

  • new_spin_angle (numpy array) – spin angles to be added

  • new_orb_a (numpy array) – semi-major axes to be added

  • new_orb_inc (numpy array) – orbital inclinations to be added

  • new_orb_ang_mom (numpy array) – orbital angular momentum to be added

  • new_orb_ecc (numpy array) – orbital eccentricities to be added

  • new_orb_arg_periapse (numpy array) – orbital arguments of the periapse to be added

  • new_gen (numpy array) – generations to be added

  • new_galaxy (numpy array) – galaxy iteration to be added, set to -1 if not passed

  • new_time_passed (numpy array) – time passed to be added, set to -1 if not passed

  • new_id_num (numpy array,optional) – ID numbers to be added

  • obj_num (int, optional) – Number of objects to be added.

at_id_num(id_num, attr=None)

Returns the attribute at the specified ID numbers

Parameters:
  • id_num (numpy array or float) – ID numbers of objects to return

  • attr (str) – attribute to return

Returns:

val – specified attribute at specified ID numbers

Return type:

numpy array

check_consistency()

Prints the size of each attribute to check that everything is consistent. Raises an AttributeError if all arrays do not have the same length.

copy()

Creates a deep copy of the AGNObject

Parameters:

None

Returns:

copied_object – new copy of AGNObject with no references to original AGNObject

Return type:

AGNObject

init_from_file(fname=None)
Reads in file from previous AGNObject.

Not fully implemented. Would need to init AGNObject and then read from file?

Parameters:

fname (str) – file to read in

keep_id_num(id_num_keep)

Filters AGNObject to only keep the objects at the specified ID numbers

Parameters:

id_num_keep (numpy array) – ID numbers to keep, others are removed

keep_index(idx_keep)

Filters AGNObject to only keep the objects at the specified indices.

Parameters:

idx_keep (numpy array) – indices to keep, others are removed.

property mass_total

Return the total mass

Returns:

id – The maximum id created up until now

Return type:

int

remove_id_num(id_num_remove=None)

Filters AGNObject to remove the objects at the specified ID numbers

Parameters:

id_num_keep (numpy array) – ID numbers to keep, others are removed

remove_index(idx_remove=None)

Removes objects at specified indices.

Parameters:

idx_remove (numpy array) – indices to remove

return_params()

Gets list of parameters present in object.

Parameters:

None

Returns:

parameters in object

Return type:

list

return_record_array()

Returns a numpy dictionary of all attributes in the AGNObject

Parameters:

None

Returns:

dat_out – dictionary array of all attributes in the AGNObject. Everything is written as a float.

Return type:

numpy dictionary

sort(sort_attr=None)

Sorts all attributes of the AGNObject by the passed attribute

Parameters:

sort_attr (AGNObject attribute array) – array to sort the AGNObject by

to_txt(fname=None, cols=None, extra_header=None)

Loads AGNObject into temporary multi-dim numpy array and then uses np.savetxt to save to file. Avoids the issue of pandas writing non-values as blanks instead of NaNs.

Parameters:
  • fname (str) – filename including path

  • cols (array of str) – array of header names to re-order or cut out columns, optional

  • extra_header (str) – extra information to go a line above the column names, optional

unique_id_nums()

Checks that ID numbers are unique.