mcfacts.objects.agnobject.AGNStar
- class mcfacts.objects.agnobject.AGNStar(mass=array([], dtype=float64), log_radius=array([], dtype=float64), log_luminosity=array([], dtype=float64), log_teff=array([], dtype=float64), star_X=array([], dtype=float64), star_Y=array([], dtype=float64), star_Z=array([], dtype=float64), star_num=0, **kwargs)
Bases:
AGNObjectA subclass of AGNObject for single stars. It extends AGNObject by adding attributes for mass, radius, and chemical composition.
- Creates an instance of the AGNStar class. This is a subclass
of the AGNObject class. AGNStar adds additional star-specific parameters to the AGNObject. It calculates orbital angular momentum for stars.
- Parameters:
mass (numpy array) – star mass
orb_a (numpy array) – star orbital semi-major axis with respect to the SMBH
radius (numpy array) – log of star radius in Rsun
orb_inc (numpy array) – star orbital inclination with respect to the SMBH
star_Y (numpy array) – helium fraction of stars
star_Z (numpy array) – metals fraction of stars
star_num (int, optional) – number of stars, by default 0
smbh_mass (float) – mass of the SMBH
- __init__(mass=array([], dtype=float64), log_radius=array([], dtype=float64), log_luminosity=array([], dtype=float64), log_teff=array([], dtype=float64), star_X=array([], dtype=float64), star_Y=array([], dtype=float64), star_Z=array([], dtype=float64), star_num=0, **kwargs)
- Creates an instance of the AGNStar class. This is a subclass
of the AGNObject class. AGNStar adds additional star-specific parameters to the AGNObject. It calculates orbital angular momentum for stars.
- Parameters:
mass (numpy array) – star mass
orb_a (numpy array) – star orbital semi-major axis with respect to the SMBH
radius (numpy array) – log of star radius in Rsun
orb_inc (numpy array) – star orbital inclination with respect to the SMBH
star_Y (numpy array) – helium fraction of stars
star_Z (numpy array) – metals fraction of stars
star_num (int, optional) – number of stars, by default 0
smbh_mass (float) – mass of the SMBH
Methods
__init__([mass, log_radius, log_luminosity, ...])Creates an instance of the AGNStar class. This is a subclass
add_objects([new_mass, new_spin, ...])Append new objects to the AGNObject.
add_stars([new_log_radius, ...])Append new stars to the end of AGNStar.
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.
- __repr__()
Creates a string representation of AGNStar. Prints out the number of stars present in this instance of AGNStar.
- Returns:
totals – number of stars in AGNStar
- Return type:
- 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.
- add_stars(new_log_radius=array([], dtype=float64), new_log_luminosity=array([], dtype=float64), new_log_teff=array([], dtype=float64), new_X=array([], dtype=float64), new_Y=array([], dtype=float64), new_Z=array([], dtype=float64), star_num=0, **kwargs)
Append new stars to the end of AGNStar. This method updates the star specific parameters and then sends the rest to the AGNObject add_objects() method.
- Parameters:
new_log_radius (numpy array) – log radii of new stars
new_Y (numpy array) – helium mass fraction of new stars
new_Z (numpy array) – metals mass fraction of new stars
obj_num (int, optional) – number of objects to be added, by default None
- 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.