SÍGAME main module¶
The SÍGAME package features a folder that is imported in python as the main module and contains a number of submodules. The most important submodules are listed below with a short description of the classes and functions that they each contain.
sigame.galaxy submodule¶
Module with classes to set up the main galaxy object, create and load related data products from the simulation itself (particle_data class) and processed outputs (datacube class).
-
class
sigame.galaxy.
datacube
(gal_ob, **kwargs)¶ Bases:
object
An object referring to the datacube constructed for a galaxy (in one of the ISM phases)
Note
Must be added as an attribute to a galaxy object.
-
add_Z_map
(**kwargs)¶ Adds metallicity map as numpy array to datacube object, if not there already.
-
add_m_map
(**kwargs)¶ Adds mass map as numpy array to datacube object, if not there already.
-
add_moment0_map
(**kwargs)¶ Adds moment 0 map as numpy array to datacube object, if not there already.
-
add_shape
()¶ Adds tuple of datacube dimensions (v length, x length, y length) as an attribute to datacube object.
-
add_vw_disp_map
(**kwargs)¶
-
add_vw_map
(**kwargs)¶
-
create_dc
(ISM_dc_phase)¶ Calculates the datacube of a specific ISM_phase
- ISM_dc_phase: str
The datacube ISM phase
>>> gal_ob.datacube.create_dc('GMC')
-
get_dc
(**kwargs)¶ Returns one datacube as numpy array.
-
get_kpc_per_arcsec
()¶ Returns physical scale for this galaxy in kpc per arcsec.
-
get_line_prof
(**kwargs)¶ Returns line profile in pixel-integrated Jy as numpy array.
- linestr
Line to use for map, default: ‘CII’
-
get_moment0_map
(**kwargs)¶ Returns moment 0 map in Jy*km/s per pixel as numpy array.
- linestr
Line to use for map, default: ‘CII’
- convolvebool
if True: convolve with beam of FWHM also supplied, default: False
- FWHMfloat
FWHM of beam to convolve with, default: None
- ISM_dc_phasestr
ISM datacube phase to use for moment 0 map, default: ‘tot’ (all ISM phases)
- unitsstr
units for moment0 map, default: ‘Jykms’ for Jy*km/s (other options: ‘Wm2’ for W/m^2)
-
get_total_sum
(**kwargs)¶ Returns total value of datacube for all datacube ISM phases in dictionary.
-
get_x_axis_arcsec
()¶ Returns positional axis (x or y) in arcsec.
-
-
class
sigame.galaxy.
dict_to_attr
(dictionary)¶ Bases:
object
Essentially turns dictionary into a attributes of an object.
-
class
sigame.galaxy.
galaxy
(gal_index)¶ Bases:
object
An object referring to one particular galaxy.
- gal_index: int
Galaxy index, default: 0
>>> import galaxy as gal >>> gal_ob = gal.galaxy(gal_index=0)
-
add_attr
(attr_name, verbose=False)¶ creates desired attribute and adds it to galaxy.
-
check_classification
()¶ checks if galaxy classification is correct (all galaxies are initialized with a ‘spherical’ classification.)
-
check_for_attr
(attr_name, **kwargs)¶ checks if galaxy has a specific attribute, if not then adds it.
-
get_radial_axis
()¶ returns 1D radius array for galaxy
-
class
sigame.galaxy.
interpolate_clouds
(gal_index)¶ Bases:
sigame.galaxy.galaxy
An object that will interpolate in cloud models of info such as line luminosity for one galaxy.
Child class that inherits from parent class ‘galaxy’.
-
interpolate_GMCs
()¶ Adds info from cloud model runs to GMCs
-
interpolate_dif
()¶ Adds info from cloud model runs to diffuse gas clouds
-
setup_tasks
()¶ Controls tasks to be executed, based on existing files and the overwrite [ow] parameter
-
-
class
sigame.galaxy.
particle_data
(gal_ob, **kwargs)¶ Bases:
object
An object referring to the particle data (sim or ISM)
Note
Must be added as an attribute to a galaxy object.
- gal_obobject
Instance of galaxy class.
- silentbool
Parameter telling the code to do (or not) print statements.
>>> import galaxy as gal >>> gal_ob = gal.galaxy(gal_index=0) >>> simgas = gal_ob.particle_data.get_data(data='sim')['gas']
-
add_Z_map
(**kwargs)¶ Adds metallicity map as numpy array to particle data object, if not stored already in sigame/temp/maps/metallicity/.
-
add_names
()¶ Add file location for particle data file (sim_type or ISM_phase)
-
get_data
(**kwargs)¶ Returns rotated particle data as dataframe.
- particle_namestr
Name of particles, can be [‘gas’,’star’,’dm’,’GMC’,’dif’], default: ‘GMC’
-
get_map
(**kwargs)¶ Creates map of surface densities (or sum) of some parameters in sim or ISM data.
- quanstr
What gets mapped, default: ‘m’
- ISM_phasestr
If set, ISM data will be used, default: ‘’
- sim_typestr
If set, sim data will be used, default: ‘’
- get_sumbool
If True, return map of summed values not divided by area, default: False
-
get_raw_data
(**kwargs)¶ Returns raw not rotated particle data in dictionary.
-
plot_map
(**kwargs)¶ Creates map of surface densities (or sum) of some parameters in sim or ISM data.
-
class
sigame.galaxy.
subgrid_galaxy
(gal_index)¶ Bases:
sigame.galaxy.galaxy
An object that will contain the subgrid information for one galaxy. Child class that inherits from parent class ‘galaxy’.
-
add_FUV
()¶ Adds FUV radiation field to galaxy and stores gas/star sim particle data files again with the new information.
-
add_GMCs
()¶ Generates GMCs and creates new GMC particle data file for a galaxy.
-
add_P_ext
()¶ Adds external pressure to galaxy and stores gas/star sim particle data files again with the new information.
-
add_dif
()¶ Generates diffuse gas clouds and creates new dif particle data file for a galaxy.
-
setup_tasks
()¶ Controls tasks to be executed, based on existing files and the overwrite [ow] parameter
-
-
class
sigame.galaxy.
var
(val, err)¶ Bases:
object
takes a value and its err and returns strings of printable values with appropriate significant figures for presenting data.
sigame.global_results submodule¶
Module: global_results
-
class
sigame.global_results.
global_results
(**kwargs)¶ Bases:
object
An object referring to the global results of a selection of galaxies, containing global properties of as attributes.
>>> import global_results as glo >>> GR = glo.global_results() >>> GR.print_results()
-
print_galaxy_properties
(**kwargs)¶
-
print_results
()¶
-
sigame.plot submodule¶
Module: plot
-
sigame.plot.
OI_OIII_SFR
(plotmodels=True, twopanel=True)¶ Inspect [OI]63micron AND [OIII]88micron emission (called by line_SFR() in analysis.py)
-
sigame.plot.
SFR_Mstar
(**kwargs)¶ Plot of SFR vs stellar mass for one or more redshift groups
- colorstr
What to color-code the galaxies by, default: age
>>> import sigame as si >>> si.plot.SFR_Mstar(color='age')
-
sigame.plot.
add_CII_observations_to_plot1
(slope_models, intercept_models, mark_reasons=False, mark_uplim=False, mark_det=False, z1='z6', MW=True, ms_scaling=1, alpha=1, line='[CII]')¶ ‘ Purpose ——— Adds observatinos to plot
-
sigame.plot.
add_line_ratio_obs
(ratio='CII_NII', zred_sample='lowz')¶ Plots observations of the relevant line ratio against redshift
- ratio - str
Options: - ‘CII_NII’: plots the [CII]/[NII]205 line ratio - ‘OIII_NII’: plots the [OIII]88/[NII]122 line ratio
- zred_sample - str
Options: - ‘highz’: adds observations at high redshift - ‘lowz’: adds observations at low redshift
-
sigame.plot.
arrow_length
(n)¶
-
sigame.plot.
axis_range
(x, log=False, **kwargs)¶ Calculates a reasonable axis range
- xnp.array()
Must be given, array of values
- logbool
If True, takes the log of the values in x, default: False
- dexfloat
Dex above and below maximum values in x, effective when log == True, default: max range in x divided by 5
- fractionfloat
Fraction of maximum range in x to go above and below on the axis, effective when log == False, default: 1/5.
-
sigame.plot.
comp_ISM_phases
(**kwargs)¶ Plotting function for comparing fractions of mass or line luminosity vs. SFR of Z. Called by ISM_line_contributions and ISM_line_efficiency() and ISM_mass_contributions() in analysis.py
-
sigame.plot.
delete_old_plots
()¶
-
sigame.plot.
getlabel
(foo)¶ Gets axis labels for plots
-
sigame.plot.
grid_parameters
(histo_color='teal', FUV=0.1, ISM_phase='GMC', figsize=(10, 7))¶ Make histograms of galaxies with grid points on top What this function does ——— 1) Makes 4-panel figure with histograms of [Mgmc, G0, Z, P_ext] in GMCs 2) OR makes 4-panel figure with histograms of [nH, R, Z, Tk] in diffuse clouds Arguments ——— ISM_phase: ISM phase in cloudy models, can be either ‘GMC’ or ‘dif’ - str default: ‘GMC’ histo_color: color selection for histograms - str options:
‘<a specific color>’: all histograms will have this color
‘colsel’: each galaxy will have a different color, using colsel from param_module.read_params
-
sigame.plot.
grid_parameters_checkParam
(histo_color='teal', FUV=0.002, ISM_phase='GMC', figsize=(10, 7))¶ Make histograms of galaxies to check what parameters to be used for dif_cloud_grid.py and GMC_cloud_grid.py to make cloudy grids.
- ISM_phase: str
if ‘GMC’: make 4-panel figure with histograms of [Mgmc, G0, Z, P_ext] in GMCs if ‘dif’: make 4-panel figure with histograms of [nH, R, Z, Tk] in diffuse clouds
- histo_color: str
color selection for histograms options:
‘<a specific color>’: all histograms will have this color
‘colsel’: each galaxy will have a different color, using colsel from param_module.read_params
-
sigame.plot.
histos
(**kwargs)¶ Makes histograms of all (particles in all) galaxies in the sample on the same plot.
- binsint/float
Number of bins, default: 100
- addbool
If True, add to an existing plot, default: False
- one_colorbool
If True, use only one color for all lines, default: True
- fs_labelsint/float
Fontsize, default: 15
-
sigame.plot.
line_SFR
(**kwargs)¶ Plots line luminosity against SFR (together with observations)
- line: str
Line to look at, default: ‘CII’
-
sigame.plot.
line_prof
(**kwargs)¶ Plots line luminosity against SFR (together with observations)
- line: str
Line to look at, default: ‘CII’
-
sigame.plot.
make_contour
(i, fontsize, kwargs)¶ Makes contour plot (called by simple_plot)
- contour_type: str
Method used to create contour map (see simple_plot)
-
sigame.plot.
map_line
(**kwargs)¶ Makes moment0 map of line using datacubes.
- gal_index: int
Galaxy index, default: 0
- linestr
Line to use for map, default: ‘CII’
- R_maxfloat
Maximum radius for moment0 map in kpc, default: 15
- ISM_dc_phasestr
ISM phase(s) to map, default: ‘tot’ (sum of all)
- unitsstr
Units; ‘Wm2’ for W/m^2, ‘Jykms’ for Jy*km/s, default: ‘Jykms’
- convolvebool
Whether moment0 map should be convolved by corresponding Herschel beam, default: True
- min_fractionfloat
Fraction of maximum in image used as lower limit for colorbar, default: 1/1e6
-
sigame.plot.
set_mpl_params
()¶
-
sigame.plot.
simple_plot
(**kwargs)¶ A function to standardize all plots
- Plots that can be created this way:
errorbar plot (with x and/or y errorbars)
line
histogram
markers
bar
hexbin
contour plot
scatter plot
hatched/filled region
The ‘1’ below can be replaced by ‘2’, ‘3’, ‘4’ etc for several plotting options in the same figure.
- addbool
If True add to existing axis object, otherwise new figure+axes will be created, default: False
- figint
Figure number, default: 0
- figsizetuple
Figure size, default: (8,6)
- fignamestr
If defined, a figure will be saved with this path+name, default = not defined (no figure saved)
- figtypestr
Format of figure, default: ‘png’
- figresfloat
The dpi of the saved figure, default: 1000
- fontsizefloat
Fontsize of tick labels, default: 15
- x1list or numpy array
x values
- y1list or numpy array
y values
- xrlist
x range
- yrlist
y range
- xlogbool
If True: x-axis will be in log units
- ylogbool
If True: y-axis will be in log units
- fill1str
If defined, markers will be used (‘y’ for filled markers, ‘n’ for open markers), default: ‘y’
- ls1str
Linestyle, default: ‘None’ (markers by default)
- ds1str
Drawstyle, default: ‘None’ (solid line by default)
- ma1str
Marker type, default: ‘x’
- ms1int/float
Marker size, default: 5
- mew1int/float
Marker edge width, default: 2
- col1str
Color of markers/lines, default: ‘k’
- ecol1str
Edgecolor, default: ‘k’
- lab1str
Label for x1,y1 points, default: ‘’
- alpha1float
Transparency fraction, default: 1.1
- dashes1str
Custom-made dashes/dots, default = ‘’
- legendbool
Whether to plot legend or not, default: False
- leg_fsfloat
Legend fontsize, default: not defined (same as fontsize for labels/tick marks)
- leglocstr or list of coordinates
Legend location, default: ‘best’
- cmap1str
Colormap for contour plots, default: ‘viridis’
- xlabstr
x axis label, default: no label
- ylabstr
y axis label, default: no label
- titlestr
Plot title, default: no title
- xticks: bool
Whether to put x ticks or not, default: True
- yticks: bool
Whether to put y ticks or not, default: True
- lab_to_tickint/float
If axis labels should be larger than tick marks, say how much here, default: 1.0
- lex1,uex1: list or numpy array
Lower and upper errorbars on x1, default: None, options: If an element in uex1 is 0 that element will be plotted as upper limit in x
- ley1,uey1: list or numpy array
lower and upper errorbars on y1, default: None, options: If an element in uey1 is 0 that element will be plotted as upper limit in y
- histo1bool
Whether to make a histogram of x1 values, default: False
- histo_real1bool
Whether to use real values for histogram or percentages on y axis, default: False
- bins1int
Number of bins in histogram, default: 100
- weights1list or numpy array
weights to histogram, default: np.ones(len(x1))
- hexbin1bool
If True, will make hexbin contour plot, default: False
- contour_type1str
If defined, will make contour plot, default: not defined, options: plain: use contourf on colors alone, optionally with contour levels only (no filling), hexbin: use hexbin on colors alone, median: use contourf on median of colors, mean: use contourf on mean of colors, sum: use contourf on sum of colors
- barwidth1float
If defined, will make bar plot with this barwidth
- scatter_color1list or numpy array
If defined, will make scatter plot with this color, default: not defined (will not do scatter plot)
- colormin1float
Minimum value for colorbar in scatter plot, default: not defined (will use all values in scatter_color1)
- lab_colorbarstr
Label for colorbar un scatter plot, default: not defined (will not make colorbar)
- hatchstyle1str
If defined, make hatched filled region, default: not defined (will not make hatched region), options: if set to ‘’, fill with one color, otherwise, use ‘/’ ‘//’ ‘///’’ etc.
- textstr
If defined, add text to figure with this string, default: not defined (no text added)
- textloclist
Must be specified in normalized axis units, default: [0.1,0.9]
- textboxbool
If True, put a box around text, default: False
- fontsize_textint/float
Fontsize of text on plot, default: 0/7 * fontsize
- gridbool
Turn on grid lines, default: False
- SC_returnbool
Return scatter plot object or not, default = False
-
sigame.plot.
trim_df
(file, skip, maxcol)¶ Comment columns to trim a dataframe