PyLenstool object functions

class pylenstool.lenstool_param_file(param_file='/home/docs/checkouts/readthedocs.org/user_builds/pylenstool/envs/latest/local/lib/python2.7/site-packages/pylenstool-0.1-py2.7.egg/pylenstool/default_param_file.par')

Methods

check_number_of_lens([verbose]) Updates nlentille, nlens_opt, and the number in multfile value to reflect the current number of lenses and multiple images
clean() Remove all runmode commands and do not make the model producing any critical or caustic line.
ds9regdeg2dwcs([name_reg, prefix_dwcs]) Transform a ds9 region file in a contour dwcs file (used in the section cleanlens contour) The ds9 region file need to be save in degrees and the contour need to be polygon (not ellispe, box or anything else)
get_comments() Returns the list of comments
get_core() Returns a list of list containings all section and parameters
get_inputfilename() Returns the name of the initial parameter used
get_parameter(section_name, param_name[, …]) Returns the value(s) for a given parameter for a given section Becarefull, if two sections have the same name, the ouput will contain all of them into one list
get_ref() Returns a list containing the RA and DEC reference value used by the model
get_section() Returns the name of all the sections as a list
get_zlens() Returns a list of all the different redshifts of potentiel which are present in the model
keep_only_some_potentials(pot_to_keep) Removes every potential which not in the list of IDs given in argument.
keep_potential(pot_to_keep) Removes every potential which not in the list of IDs given in argument.
launch_model([name, screen, …]) Launches the parameter file
remove_parameter(section, param[, verbose]) Removes for a specified section the specified parameter.
remove_potential(pot_to_keep) Removes every potential which are in the list of IDs given in argument.
set_parameter(section, param[, add]) Replaces (or creates, if it does not exist) the section and the parameter given in arguments.
write_param_file([output_filename, …]) Writes the parameter file which is currently loaded
zoom_window(RAcen, DECcen, size) Change the champ section to zoom on a square around the position If RAcen and DECcen equal 0 the reference positions are taken as the center point
check_number_of_lens(verbose=True)

Updates nlentille, nlens_opt, and the number in multfile value to reflect the current number of lenses and multiple images

clean()

Remove all runmode commands and do not make the model producing any critical or caustic line. An hard list of known command is put in pylenstool (It might miss something. Please send a report).

ds9regdeg2dwcs(name_reg='ds9.reg', prefix_dwcs='poly')

Transform a ds9 region file in a contour dwcs file (used in the section cleanlens contour) The ds9 region file need to be save in degrees and the contour need to be polygon (not ellispe, box or anything else)

Parameters:
name_reg : string

Name of the region file

prefix_dwcs : string

Name of the prefix of the outpulie dwcs file the routine iterate on the number of polygon.

Returns
———-
num : list

Return the list of all the output name file

get_comments()

Returns the list of comments

get_core()

Returns a list of list containings all section and parameters

get_inputfilename()

Returns the name of the initial parameter used

get_parameter(section_name, param_name, verbose=True)

Returns the value(s) for a given parameter for a given section Becarefull, if two sections have the same name, the ouput will contain all of them into one list

get_ref()

Returns a list containing the RA and DEC reference value used by the model

get_section()

Returns the name of all the sections as a list

get_zlens()

Returns a list of all the different redshifts of potentiel which are present in the model

keep_only_some_potentials(pot_to_keep)

Removes every potential which not in the list of IDs given in argument. If you want to keep the parameter file and make a copy, use pylenstool.keep_only_some_potentials(parameter_file,pot_to_keep)

Parameters:
pot_to_keep : list of string

list of potential names

keep_potential(pot_to_keep)

Removes every potential which not in the list of IDs given in argument. If you want to keep the parameter file and make a copy, use pylenstool.keep_potential(parameter_file,pot_to_keep)

Parameters:
pot_to_keep : list of string

list of potential names

launch_model(name='pylenstool_model.par', screen=False, OMP_NUM_THREADS='default', check_count_lens=True, launching_name_of_lenstool='lenstool')

Launches the parameter file

Parameters:
name : string

Name of the outputfile by DEFAULT it is pylenstool_model.par

screen : boolean

Puts True if you want to screen your lenstool

OMP_NUM_THREADS : int

Gives the number of threads you want to use, it takes by default your environnment value

check_count_lens : boolean

False if you do not want to change nlentille and nlens_opt By default the nlentille and nlens_opt will be updated

launching_name_of_lenstool : string

the name of the command that launch lenstool By default it is lenstool. (e.g. it could be lenstoolv7 or lenstoolv6.5)

remove_parameter(section, param, verbose=True)

Removes for a specified section the specified parameter.

Parameters:
section : string

section name

param : string

param name

remove_potential(pot_to_keep)

Removes every potential which are in the list of IDs given in argument. If you want to keep the original parameter file and make a copy with the updated potentials, do not use this method but the function pylenstool.remove_potential(parameter_file,pot_to_keep)

Parameters:
pot_to_keep : list of string

list of potential names

set_parameter(section, param, add=False)

Replaces (or creates, if it does not exist) the section and the parameter given in arguments. By default the previous entry will be replaced, unless it is specified by the keyword add that it should be added.

Parameters:
section : string

Name of the section of parameters, such as runmode, potentiel XX, cline …

param : string

Full sequence of the parameter in one string eg. ‘mass 3 1000 0.308 mass_minim.fits’

add : boolean

If True a new line will be added without replacing, False by default.

eg. pf.set_parameter(‘runmode’,’mass 3 1000 0.308 mass_minim.fits’)
write_param_file(output_filename='pylenstool_model.par', check_count_lens=True, verbose=True)

Writes the parameter file which is currently loaded

Parameters:
output_filename : string

gives the name of the output file, by default it is pylenstool_model.par

check_count_lens : boolean

False if you do not want to change nlentille and nlens_opt By default the nlentille and nlens_opt will be updated

zoom_window(RAcen, DECcen, size)

Change the champ section to zoom on a square around the position If RAcen and DECcen equal 0 the reference positions are taken as the center point

Parameters:
RAcen : The right ascension in degrees
DECcen : The declination in degrees
size : size of one edge of the square in arcsec