mcfacts.objects.agnobject.AGNBinaryStar
- class mcfacts.objects.agnobject.AGNBinaryStar(star_mass1=None, star_mass2=None, star_log_radius1=None, star_log_radius2=None, star_Y1=None, star_Y2=None, star_Z1=None, star_Z2=None, bin_e=None, bin_a=None, bin_inc=None, cm_orb_a=None, cm_orb_inc=None, cm_orb_ecc=None, obj_num=None, **kwargs)
Bases:
AGNObjectAn array of binary stars. Should include all objects of this type. No other objects should include objects of this type. Properties of this class:
scalar properties of each star: masses, radius, Y,Z (star_mass1,star_mass2, star_radius1, star_radius2, …)
vector properties of each star: individual angular momentum vectors (spin1,spin_angle_1) relative to the z axis of the binary orbit, not SMBH
orbit properties: use a reduced mass hamiltonian, you have ‘r = r2 - r1’ (vector) for which we get bin_a, bin_e, bin_inc (relative to SMBH)
Creates an instance of the AGNObject class.
- Parameters:
mass (numpy array) – masses in Msun
spin (numpy array) – spins
spin_angle (numpy array) – spin angles in radians
orb_a (numpy array) – orbital semi-major axis with respect to the SMBH in R_g
orb_inc (numpy array) – orbital inclination with respect to the SMBH
orb_ang_mom (numpy array) – orbital angular momentum with respect to the SMBH
orb_ecc (numpy array) – orbital eccentricity with respect to the SMBH
orb_arg_periapse (numpy array) – argument of the orbital periapse with respect to the SMBH set to -1 if not otherwise set. currently used only for retros
galaxy (numpy array) – galaxy iteration
time_passed (numpy array) – time passed
obj_num (int, optional) – number of objects, by default 0
id_start_val (numpy array) – ID numbers for the objects, by default 0
- __init__(star_mass1=None, star_mass2=None, star_log_radius1=None, star_log_radius2=None, star_Y1=None, star_Y2=None, star_Z1=None, star_Z2=None, bin_e=None, bin_a=None, bin_inc=None, cm_orb_a=None, cm_orb_inc=None, cm_orb_ecc=None, obj_num=None, **kwargs)
Creates an instance of the AGNObject class.
- Parameters:
mass (numpy array) – masses in Msun
spin (numpy array) – spins
spin_angle (numpy array) – spin angles in radians
orb_a (numpy array) – orbital semi-major axis with respect to the SMBH in R_g
orb_inc (numpy array) – orbital inclination with respect to the SMBH
orb_ang_mom (numpy array) – orbital angular momentum with respect to the SMBH
orb_ecc (numpy array) – orbital eccentricity with respect to the SMBH
orb_arg_periapse (numpy array) – argument of the orbital periapse with respect to the SMBH set to -1 if not otherwise set. currently used only for retros
galaxy (numpy array) – galaxy iteration
time_passed (numpy array) – time passed
obj_num (int, optional) – number of objects, by default 0
id_start_val (numpy array) – ID numbers for the objects, by default 0
Methods
__init__([star_mass1, star_mass2, ...])Creates an instance of the AGNObject class.
add_binaries([new_star_mass1, ...])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
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.
Gets list of parameters present in object.
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.
Checks that ID numbers are unique.
- 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
- 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:
- 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.
- 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:
- 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.
- unique_id_nums()
Checks that ID numbers are unique.