pyCloudy
0.9.6
manage Cloudy photoionization code
|
Classes | |
class | ImportFromFile |
Functions | |
def | execution_path (filename) |
def | sextract |
def | half_gaussian |
def | gaussian |
def | gauss_kern |
def | blur_image |
def | Hb_prof (x, zeta_0) |
def | convol (y, kernel) |
def | save (file_, args, kwargs) |
def | restore (file_) |
def | convert_label (str_) |
def | dist_point_line (P, P0, P1) |
def | points_right_of_line (x, y, P0, P1) |
def | points_left_of_line (x, y, P0, P1) |
def | points_inside_triangle (x, y, P0, P1, P2) |
def | int_to_roman (input_) |
def | roman_to_int (input_) |
def | get_elem_ion (label) |
def | pyneb2cloudy |
def | cloudy2pyneb |
def | convert2RGB (im_R, im_G, im_B) |
def | make_mask |
def | revert_seterr (oldsettings) |
def | quiet_divide (a, b) |
def | quiet_log10 (a) |
def | fill_from_file |
def | write_cols (tab, N, open_file) |
def | read_atm_ascii (ascii_file) |
def | convert_c13_c17 (label) |
def | convert_c17_c13 (label) |
def | correc_He1 |
def pyCloudy.utils.misc.blur_image | ( | im, | |
n, | |||
ny = None |
|||
) |
blurs the image by convolving with a gaussian kernel of typical size n. The optional keyword argument ny allows for a different size in the y direction.
def pyCloudy.utils.misc.cloudy2pyneb | ( | file_ = 'pyneb2cloudy.txt' | ) |
define a dictionary to translate cloudy labels into pyneb atom.lines
def pyCloudy.utils.misc.convert2RGB | ( | im_R, | |
im_G, | |||
im_B | |||
) |
def pyCloudy.utils.misc.convert_c13_c17 | ( | label | ) |
Transform a label from c13 style into c17+ style
def pyCloudy.utils.misc.convert_c17_c13 | ( | label | ) |
Transform a label from c17+ style into c13 style
def pyCloudy.utils.misc.convert_label | ( | str_ | ) |
converts a line in format Cloudy to a line in format pyCloudy ex: convert_label('C 2 1335') is C__2__1335A convert_label('Ne 3 15.55m') is NE_3_1555M
def pyCloudy.utils.misc.convol | ( | y, | |
kernel | |||
) |
def pyCloudy.utils.misc.correc_He1 | ( | tem = 1e4 , |
|
den = 1e2 , |
|||
lambda_ = 5876 , |
|||
print_only_lambdas = False |
|||
) |
Compute the correction to the CA_B__5876A , CA_B__4471A , and CA_B__6678A line intensities. Using formula 3 and table 3 from Izotov et al. 2013, A&A 558, A57
def pyCloudy.utils.misc.dist_point_line | ( | P, | |
P0, | |||
P1 | |||
) |
computing the distance between point x,y and line (x0,y0)->(x1,y1)
def pyCloudy.utils.misc.execution_path | ( | filename | ) |
def pyCloudy.utils.misc.fill_from_file | ( | N, | |
open_file, | |||
dtype = np.float64 |
|||
) |
Read N elements from an already open file and put them to a numpy array. The elements don't need to be in rectangular form, e.g. the following 10 elements can be read: 1 2 3 4 2 3 4 5 2 4
def pyCloudy.utils.misc.gauss_kern | ( | size, | |
sizey = None |
|||
) |
Returns a normalized 2D gauss kernel array for convolutions
def pyCloudy.utils.misc.gaussian | ( | x, | |
zeta_0 = None , |
|||
sigma = None , |
|||
FWHM = None |
|||
) |
Return the value of a gaussian function. param: x One of the following parameter must be given: zeta_0, sigma or FWHM
def pyCloudy.utils.misc.get_elem_ion | ( | label | ) |
Split a Cloudy label into elem and ion
def pyCloudy.utils.misc.half_gaussian | ( | N = 100 , |
|
sigma = 1. |
|||
) |
def pyCloudy.utils.misc.Hb_prof | ( | x, | |
zeta_0 | |||
) |
The Hbeta profile is sum of 2 blocks of lines (actually 3 + 4 lines)
def pyCloudy.utils.misc.int_to_roman | ( | input_ | ) |
Convert an integer to Roman numerals. Examples: >>> int_to_roman(0) Traceback (most recent call last): ValueError: Argument must be between 1 and 3999 >>> int_to_roman(-1) Traceback (most recent call last): ValueError: Argument must be between 1 and 3999 >>> int_to_roman(1.5) Traceback (most recent call last): TypeError: expected integer, got <type 'float'> >>> print int_to_roman(2000) MM >>> print int_to_roman(1999) MCMXCIX
def pyCloudy.utils.misc.make_mask | ( | X, | |
Y, | |||
ap_center, | |||
ap_size, | |||
seeing = None |
|||
) |
def pyCloudy.utils.misc.points_inside_triangle | ( | x, | |
y, | |||
P0, | |||
P1, | |||
P2 | |||
) |
Determine if a point is in a triangle Adapted from http://paulbourke.net/geometry/insidepoly/ param: x, y [float] coordinates of the test point P1, P2, P3 [list or tupple or array of 3 elements] coordinates of the triangle corners. return: [boolean] True if points (x,y) is/are inside a triangle P0-P1-P2.
def pyCloudy.utils.misc.points_left_of_line | ( | x, | |
y, | |||
P0, | |||
P1 | |||
) |
Return True if the point (x,y) is left to the line P0-P1
def pyCloudy.utils.misc.points_right_of_line | ( | x, | |
y, | |||
P0, | |||
P1 | |||
) |
Return True if the point (x,y) is right to the line P0-P1
def pyCloudy.utils.misc.pyneb2cloudy | ( | file_ = 'pyneb2cloudy.txt' , |
|
with_ = False |
|||
) |
define a dictionary to translate pyneb labels, as used in observation files, into Cloudy label ex: 'N2_6583A': 'N 2 6584A' the with_ option transform the output into pyCloudy label: ex: 'Ne3_3869A': 'NE_3__3869A'
def pyCloudy.utils.misc.quiet_divide | ( | a, | |
b | |||
) |
This function returns the division of a by b, without any waring in case of b beeing 0.
def pyCloudy.utils.misc.quiet_log10 | ( | a | ) |
This function returns the log10 of a, without any waring in case of b beeing 0.
def pyCloudy.utils.misc.read_atm_ascii | ( | ascii_file | ) |
20060612 1 1 Teff 1 110396 lambda 1.00000000e+00 F_lambda 2.37160000e+20 1.070E+05 43.2662 43.3385 43.4109 43.4834 43.5561 43.6288 43.7017 43.7747 43.8479 43.9211
def pyCloudy.utils.misc.restore | ( | file_ | ) |
Read data saved with save function. Usage: datos = restore('misdatos.pypic')
def pyCloudy.utils.misc.revert_seterr | ( | oldsettings | ) |
This function revert the options of seterr to a value saved in oldsettings. Usage: oldsettings = np.seterr(all='ignore') to_return = (result - int_ratio) / int_ratio # this will not issue Warning messages revert_seterr(oldsettings) Parameter: oldsettings: result of np.seterr(all='ignore')
def pyCloudy.utils.misc.roman_to_int | ( | input_ | ) |
Convert a roman numeral to an integer. >>> r = range(1, 4000) >>> nums = [int_to_roman(i) for i in r] >>> ints = [roman_to_int(n) for n in nums] >>> print r == ints 1 >>> roman_to_int('VVVIV') Traceback (most recent call last): ... ValueError: input is not a valid roman numeral: VVVIV >>> roman_to_int(1) Traceback (most recent call last): ... TypeError: expected string, got <type 'int'> >>> roman_to_int('a') Traceback (most recent call last): ... ValueError: input is not a valid roman numeral: A >>> roman_to_int('IL') Traceback (most recent call last): ... ValueError: input is not a valid roman numeral: IL
def pyCloudy.utils.misc.save | ( | file_, | |
args, | |||
kwargs | |||
) |
Save the value of some data in a file. Usage: save('misdatos.pypic','a',b=b)
def pyCloudy.utils.misc.sextract | ( | text, | |
par1 = None , |
|||
par2 = None |
|||
) |
extract a substring from text (first parameter)
If par1 is a string, the extraction starts after par1, else if it is an integer, it starts at position par1. If par 2 is a string, extraction stop at par2, else if par2 is an integer, extraction stop after par2 characters. ex: sextract('test123','e','1') sextract('test123','st',4)
def pyCloudy.utils.misc.write_cols | ( | tab, | |
N, | |||
open_file | |||
) |
Write an array into an already open file, using N columns