pyCloudy
0.9.6
manage Cloudy photoionization code
|
Inherits object.
Public Member Functions | |
def | __init__ |
CloudyInput object. More... | |
def | init_all (self) |
def | set_save_str |
def | set_radius |
def | set_BB |
def | set_star |
def | set_cste_density |
def | set_dlaw |
def | set_fudge |
def | set_sphere |
def | set_iterate |
def | set_grains |
def | set_stop |
def | read_emis_file |
def | set_emis_tab |
def | import_file |
def | set_line_file |
def | set_theta_phi |
def | set_abund |
define the abundances More... | |
def | set_other |
def | set_comment |
def | set_C3D_comment |
def | set_distance |
def | set_heat_cooling |
def | print_input |
def | run_cloudy |
def | print_make_file |
Public Attributes | |
log_ | |
calling | |
model_name | |
save_list | |
cloudy_version | |
save_str | |
line_file_absolute | |
Object used to create and write input file for Cloudy code.
def __init__ | ( | self, | |
model_name = None |
|||
) |
CloudyInput object.
- model_name : name of the model. Used to name the input file and all the output files. The other parameters of the model are set using the methods
def import_file | ( | self, | |
file_ = None |
|||
) |
Import a file that will be append to the input file.
def init_all | ( | self | ) |
def print_input | ( | self, | |
to_file = True , |
|||
verbose = False |
|||
) |
This is the method to print the input file. Parameters: - to_file: Boolean. If True (default), print to the file defined as model_name + '.in' - verbose: Boolean. If True (not default), print to the standart output
def print_make_file | ( | self, | |
dir_ = None |
|||
) |
Call pc.print_make_file. Parameter: dir_: if None, extract the string before the last / in the model_name. Otherwise, use the value
def read_emis_file | ( | self, | |
emis_file, | |||
N_char = 12 |
|||
) |
Define the name of the file containing the labels for the list of emissivities to output in the .emis file
def run_cloudy | ( | self, | |
dir_ = None , |
|||
n_proc = 1 , |
|||
use_make = False , |
|||
model_name = None , |
|||
precom = "" |
|||
) |
Method to run cloudy. Parameters: - dir_: Directory where the model input files are - n_proc: number of CPUs to run (default=1) - use_make: if True (default), make is used. Otherwise Cloudy is run on one single model, assuming that model_name.in exists - model_name: if None, the models of this object is run, if not None, used by: make name="model_name" or cloudy < model_name.in - precom: a string to put before Cloudy (e.g. "\nice 10")
def set_abund | ( | self, | |
predef = None , |
|||
elem = None , |
|||
value = None , |
|||
nograins = True , |
|||
ab_dict = None , |
|||
metals = None , |
|||
metalsgrains = None |
|||
) |
define the abundances
Defines the abundances. Parameters: - predef : one of the Cloudy predefined abundances (e.g. "ism", "hii region") - elem and value: used to set one abundance, e.g, elem = 'O', value = -4.5 - nograins: Boolean value - ab_dict: dictionnary of elem and values. - metals: value by which all the metals are multiplied
def set_BB | ( | self, | |
Teff = None , |
|||
lumi_unit = None , |
|||
lumi_value = None |
|||
) |
Add a Black Body as SED. Parameters: - Teff: Effective temeprature, in K. - lumi_unit: a Cloudy unit for the luminosity (e.g 'q(H)', 'total luminosity', 'logU') - lumi_value: the value of the luminosity
def set_C3D_comment | ( | self, | |
comment = None |
|||
) |
Add special comment that will be added in the input file in the form of: C3D comment Parameter: - comment: if None, reset the list, otherwise, append its value to the list
def set_comment | ( | self, | |
comment = None |
|||
) |
Add special comment that will be added in the input file in the form of: C ** comment Parameter: - comment: if None, reset the list, otherwise, append its value to the list
def set_cste_density | ( | self, | |
dens = None , |
|||
ff = None |
|||
) |
Set the density of the model to a constant value Parameters: - dens: the density (in log(cm-3)) - ff: filling factor (unused if None, default value)
def set_distance | ( | self, | |
dist = None , |
|||
unit = 'kpc' , |
|||
linear = True |
|||
) |
Set the distance to the object. Parameters: - dist = float - unit = ('kpc', 'Mpc', 'parsecs', 'cm') - linear = boolean
def set_dlaw | ( | self, | |
dlaw_params, | |||
ff = None |
|||
) |
Define the user-define density law. Parameters: - dlaw_params may beof type: 1.4, '1.4, 5.6, 7e45' or (1, 2, 4.5) - ff: filling factor
def set_emis_tab | ( | self, | |
emis_tab_str = None |
|||
) |
Accept a list of line labels that will be used as: save last lines emissivity ".emis" *** enumeration of the elements of the list *** end of lines
def set_fudge | ( | self, | |
fudge_params = None |
|||
) |
Define a user-defined fudge parameter. Parameter: - fudge_params: may be: 1.4, '1.4, 5.6, 7e45' or (1, 2, 4.5)
def set_grains | ( | self, | |
grains = None |
|||
) |
Append grains to the list. Parameter: - grains: if None, reset the grains list, otherwise append the value of the parameter to the list.
def set_heat_cooling | ( | self, | |
cextra = None , |
|||
hextra = None |
|||
) |
def set_iterate | ( | self, | |
n_iter = None , |
|||
to_convergence = False |
|||
) |
Set the iterate parameter. Parameter: - n_iter: If None, set the iterate parameter to "iterate" in the Cloudy input file, if ==0, unset the iterate (nothing will be printed), otherwise set iterate to the value of n_iter. - to_convergence [False]: If True, iterate to convergence is printed out. n_iter without effect then
def set_line_file | ( | self, | |
line_file = None , |
|||
absolute = False |
|||
) |
Set a file name containing a list of lines. Is used in the input file as: save last linelist ".lin" "***line_file***"
def set_other | ( | self, | |
other_str = None |
|||
) |
Define any other command line to be added to the Cloudy input file Parameter: - other_str: if None, reset the list, otherwise, append its value to the list
def set_radius | ( | self, | |
r_in = None , |
|||
r_out = None |
|||
) |
param: r_in [float] (log cm) optional: r_out [float] (log cm)
def set_save_str | ( | self, | |
save = 'save' |
|||
) |
This determine if "save" (default) or "punch" is used in the input file Parameter: - save: "save" (default) or "punch". If another value is sent, "save" is used.
def set_sphere | ( | self, | |
sphere = True |
|||
) |
Set the sphere parameter if True, unset it otherwise.
def set_star | ( | self, | |
SED = None , |
|||
SED_params = None , |
|||
lumi_unit = None , |
|||
lumi_value = None |
|||
) |
Add a table to the SED. Parameters: - SED: The SED description, like "table Rauch" - SED_params: parameter(s) for the SED. May be a list or a tuple, of strings or floats or a simple string with everything in it.
def set_stop | ( | self, | |
stop_criter = None |
|||
) |
Append a stopping criterium to the list. Parameters: - stop: if None, the list is reset, otherwise the value of the parameter is append to the list may be a list or a tuple of criteria.
def set_theta_phi | ( | self, | |
theta = None , |
|||
phi = None |
|||
) |
Set the values of the theta and phi angles for the 3D models
calling |
cloudy_version |
line_file_absolute |
log_ |
model_name |
save_list |
save_str |