mcfacts.objects.agnobject.AGNFilingCabinet
- class mcfacts.objects.agnobject.AGNFilingCabinet(id_num, category, orb_a, mass, orb_ecc, size, direction=None, disk_inner_outer=None, fc_num=0)
Bases:
AGNObjectMaster catalog of all objects in the disk. Each object has a unique ID number, type, and orbital direction. Currently it also takes in all parameters present in AGNObject, but these are not updated when the instances of AGNBlackHole and AGNStar are updated.
Creates an instance of AGNFilingCabinet. It extends AGNObject by recording ID numbers for each object and their category, so that they can be easily found in their respective AGNObjects.
- Parameters:
id_num (numpy array) – ID numbers of the objects
category (numpy array of ints) – category (black hole, star, etc.) of the objects
orb_a (numpy array) – orbital semi-major axis [r_{g,SMBH}] with respect to the SMBH
mass (numpy array) – masses [Msun] of the objects (for binaries this is total mass)
orb_ecc (numpy.ndarray) – Orbital eccentricity with respect to the SMBH
size (numpy array) – for BH this is set to -1.5, for stars this is set to the stellar radius in R_g, for binaries this is the binary’s semi-major axis (aka separation) in R_g in R_g
direction (numpy array) – direction of the orbit of the objects, optional
disk_inner_outer (numpy array) – if the object is in the inner or outer disk
- __init__(id_num, category, orb_a, mass, orb_ecc, size, direction=None, disk_inner_outer=None, fc_num=0)
Creates an instance of AGNFilingCabinet. It extends AGNObject by recording ID numbers for each object and their category, so that they can be easily found in their respective AGNObjects.
- Parameters:
id_num (numpy array) – ID numbers of the objects
category (numpy array of ints) – category (black hole, star, etc.) of the objects
orb_a (numpy array) – orbital semi-major axis [r_{g,SMBH}] with respect to the SMBH
mass (numpy array) – masses [Msun] of the objects (for binaries this is total mass)
orb_ecc (numpy.ndarray) – Orbital eccentricity with respect to the SMBH
size (numpy array) – for BH this is set to -1.5, for stars this is set to the stellar radius in R_g, for binaries this is the binary’s semi-major axis (aka separation) in R_g in R_g
direction (numpy array) – direction of the orbit of the objects, optional
disk_inner_outer (numpy array) – if the object is in the inner or outer disk
Methods
__init__(id_num, category, orb_a, mass, ...)Creates an instance of AGNFilingCabinet.
add_objects(new_id_num, new_category, ...[, ...])Append objects to the AGNFilingCabinet.
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.
update(id_num, attr, new_info)Update a given attribute in AGNFilingCabinet for the given ID numbers
Attributes
Return the maximum id which has been created up to this point
- __repr__()
Creates a string representation of AGNFilingCabinet. Prints out the number and types of objects present in AGNFilingCabinet and their direction (prograde, retrograde, or undetermined). Not currently working.
- Returns:
totals – number and types of objects in AGNFilingCabinet
- Return type:
- add_objects(new_id_num, new_category, new_orb_a, new_mass, new_orb_ecc, new_size, new_direction, new_disk_inner_outer, fc_num=0)
Append objects to the AGNFilingCabinet.
- Parameters:
new_id_num (numpy array) – ID numbers to be added
new_category (numpy array) – categories to be added
new_orb_a (numpy array) – orbital semi-major axes to be added
new_mass (numpy array) – masses to be added
new_orb_ecc (numpy array) – new orbital eccentricities to be added
new_size (numpy array) – sizes to be added (BH: -1, stars: radii in Rsun, binaries: separation in R_g)
new_direction (numpy array) – orbital directions of objects to be added
new_disk_inner_outer (numpy array) – new inner/outer disk locations to be added
fc_num (int) – 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:
- property id_max
Return the maximum id which has been created up to this point
- Returns:
id – The maximum id created up until now
- 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.