sirepo.template package¶
Submodules¶
sirepo.template.adm module¶
Myapp execution template.
copyright: | Copyright (c) 2017-2018 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
sirepo.template.elegant module¶
sirepo.template.elegant_command_importer module¶
elegant lattice parser.
copyright: | Copyright (c) 2015 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
sirepo.template.elegant_command_parser module¶
elegant command parser.
copyright: | Copyright (c) 2016 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
sirepo.template.elegant_common module¶
Common values for elegant
copyright: | Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
-
sirepo.template.elegant_common.
RESOURCE_DIR
= local('/home/docs/checkouts/readthedocs.org/user_builds/sirepo/checkouts/latest/sirepo/package_data/template/elegant')¶ Where to get files
-
sirepo.template.elegant_common.
SIM_TYPE
= 'elegant'¶ Application name
sirepo.template.elegant_lattice_importer module¶
elegant lattice parser
copyright: | Copyright (c) 2015 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
sirepo.template.elegant_lattice_parser module¶
elegant lattice parser.
copyright: | Copyright (c) 2015 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
sirepo.template.hellweg module¶
Hellweg execution template.
copyright: | Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
-
sirepo.template.hellweg.
SIM_TYPE
= 'hellweg'¶ Simulation type
What models are required for this data[‘report’]
Parameters: data (dict) – simulation Returns: Named models, model fields or values (dict, list) that affect report Return type: list
sirepo.template.hellweg_dump_reader module¶
Hellweg dump parser.
copyright: | Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
-
class
sirepo.template.hellweg_dump_reader.
TBeamHeader
[source]¶ Bases:
_ctypes.Structure
-
beam_current
¶ Structure/Union member
-
beam_h
¶ Structure/Union member
-
beam_lmb
¶ Structure/Union member
-
input_current
¶ Structure/Union member
-
-
class
sirepo.template.hellweg_dump_reader.
TDimension
[source]¶ Bases:
_ctypes.Structure
-
Nx
¶ Structure/Union member
-
Ny
¶ Structure/Union member
-
Nz
¶ Structure/Union member
-
-
class
sirepo.template.hellweg_dump_reader.
TField
[source]¶ Bases:
_ctypes.Structure
-
r
¶ Structure/Union member
-
th
¶ Structure/Union member
-
z
¶ Structure/Union member
-
-
class
sirepo.template.hellweg_dump_reader.
TFieldMap2D
[source]¶ Bases:
_ctypes.Structure
-
Dim
¶ Structure/Union member
-
Field
¶ Structure/Union member
-
Piv
¶ Structure/Union member
-
-
class
sirepo.template.hellweg_dump_reader.
THeader
[source]¶ Bases:
_ctypes.Structure
-
NParticles
¶ Structure/Union member
-
NPoints
¶ Structure/Union member
-
-
class
sirepo.template.hellweg_dump_reader.
TParticle
[source]¶ Bases:
_ctypes.Structure
-
Th
¶ Structure/Union member
-
beta
¶ Structure/Union member
-
beta0
¶ Structure/Union member
-
lost
¶ Structure/Union member
-
phi
¶ Structure/Union member
-
r
¶ Structure/Union member
-
z
¶ Structure/Union member
-
-
class
sirepo.template.hellweg_dump_reader.
TPivot
[source]¶ Bases:
_ctypes.Structure
-
X
¶ Structure/Union member
-
Y
¶ Structure/Union member
-
Z
¶ Structure/Union member
-
-
class
sirepo.template.hellweg_dump_reader.
TStructure
[source]¶ Bases:
_ctypes.Structure
-
AF
¶ Structure/Union member
-
B
¶ Structure/Union member
-
CellNumber
¶ Structure/Union member
-
E
¶ Structure/Union member
-
Hext
¶ Structure/Union member
-
P
¶ Structure/Union member
-
Ra
¶ Structure/Union member
-
Rp
¶ Structure/Union member
-
alpha
¶ Structure/Union member
-
betta
¶ Structure/Union member
-
dF
¶ Structure/Union member
-
drift
¶ Structure/Union member
-
jump
¶ Structure/Union member
-
ksi
¶ Structure/Union member
-
lmb
¶ Structure/Union member
-
sirepo.template.jspec module¶
sirepo.template.line_parser module¶
Simple line parser.
Parses a line of input one character at a time.
copyright: | Copyright (c) 2016 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
sirepo.template.myapp module¶
Myapp execution template.
copyright: | Copyright (c) 2017-2018 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
sirepo.template.rs4pi module¶
sirepo.template.sdds_util module¶
sirepo.template.shadow module¶
sirepo.template.srw module¶
sirepo.template.srw_importer module¶
sirepo.template.srwl_uti_brightness module¶
-
sirepo.template.srwl_uti_brightness.
CalcAngularfluxUnd
(Ib, kx, kz, phix, phiz, n, nPer, E_elec, lam_u, enDetPar, relEnSpr, sigpxsq, sigpzsq)[source]¶
-
sirepo.template.srwl_uti_brightness.
CalcBrightnessUnd
(Ib, kx, kz, phix, phiz, n, E_elec, lam_u, nPer, enDetPar, relEnSpr, L, sigxsq, sigzsq, sigxpsq, sigzpsq)[source]¶
-
sirepo.template.srwl_uti_brightness.
CalcDivergenceUnd
(sigpsq, L, K, E_elec, lam_u, n, nPer, enDetPar, relEnSpr)[source]¶
-
sirepo.template.srwl_uti_brightness.
CalcFluxUnd
(Ib, kx, kz, phix, phiz, n, nPer, enDetPar, relEnSpr)[source]¶
-
sirepo.template.srwl_uti_brightness.
CalcSizeUnd
(sigsq, L, K, E_elec, lam_u, n, nPer, enDetPar, relEnSpr)[source]¶
-
sirepo.template.srwl_uti_brightness.
getE
(nHarm, Ebeam, K, lam_u)[source]¶ Return energy [eV] of nth harmonic :param nHarm: harmonic number :param Ebeam: electron beam energy [GeV] :param K: deflection parameter :param lam_u: undulator period [m]
-
sirepo.template.srwl_uti_brightness.
getK
(By, lam_u)[source]¶ Return K value :param By: vertical magnetic field [T] :param lam_u: undulator period [m]
-
sirepo.template.srwl_uti_brightness.
interpBright
(x, y, W, xmin, ymin, xstep, ystep, nx, ny)[source]¶
-
sirepo.template.srwl_uti_brightness.
srwl_und_ang_flux_en
(Ib, kxmax, kzmax, kmin, numkpts, E_elec, lam_u, phix, phiz, n, nPer, enDetPar, relEnSpr, sigpxsq, sigpzsq)[source]¶
-
sirepo.template.srwl_uti_brightness.
srwl_und_bright_en
(Ib, kx, kz, phix, phiz, n, E_elec, lam_u, nPer, epeak, enDetPar, relEnSpr, L, sigxsq, sigzsq, sigxpsq, sigzpsq, kxmax, kzmax, kmin, numkpts)[source]¶
-
sirepo.template.srwl_uti_brightness.
srwl_und_bright_en_fixedK
(Ib, kx, kz, phix, phiz, n, E_elec, lam_u, nPer, epeak, emin, emax, numepts, relEnSpr, L, sigxsq, sigysq, sigxpsq, sigypsq)[source]¶
-
sirepo.template.srwl_uti_brightness.
srwl_und_div_en
(kxmax, kzmax, kmin, numkpts, E_elec, lam_u, phix, phiz, n, nPer, enDetPar, relEnSpr, sigpsq)[source]¶
-
sirepo.template.srwl_uti_brightness.
srwl_und_div_en_fixedK
(sigsq, L, K, E_elec, lam_u, n, nPer, epeak, emin, emax, numepts, relEnSpr)[source]¶
-
sirepo.template.srwl_uti_brightness.
srwl_und_flux_en
(Ib, kxmax, kzmax, kmin, numkpts, E_elec, lam_u, phix, phiz, n, nPer, enDetPar, relEnSpr)[source]¶
-
sirepo.template.srwl_uti_brightness.
srwl_und_flux_en_fixedK
(Ib, kx, kz, E_elec, lam_u, phix, phiz, n, nPer, epeak, emin, emax, numepts, relEnSpr)[source]¶
sirepo.template.synergia module¶
sirepo.template.template_common module¶
SRW execution template.
copyright: | Copyright (c) 2015 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
-
sirepo.template.template_common.
INPUT_BASE_NAME
= 'in'¶ Input json file
-
sirepo.template.template_common.
OUTPUT_BASE_NAME
= 'out'¶ Output json file
-
sirepo.template.template_common.
PARAMETERS_PYTHON_FILE
= 'parameters.py'¶ Python file (not all simulations)
-
sirepo.template.template_common.
RUN_LOG
= 'run.log'¶ stderr and stdout
-
sirepo.template.template_common.
compute_field_range
(args, compute_range)[source]¶ Computes the fieldRange values for all parameters across all animation files. Caches the value on the animation input file. compute_range() is called to read the simulation specific datafiles and extract the ranges by field.
-
sirepo.template.template_common.
compute_plot_color_and_range
(plots)[source]¶ For parameter plots, assign each plot a color and compute the full y_range.
-
sirepo.template.template_common.
copy_lib_files
(data, source, target)[source]¶ Copy auxiliary files to target
Parameters: - data (dict) – simulation db
- target (py.path) – destination directory
-
sirepo.template.template_common.
file_extension_ok
(file_path, white_list=[], black_list=['py', 'pyc'])[source]¶ Determine whether a file has an acceptable extension
Parameters: Returns: True If white_list non-empty: True if the file’s extension matches any in the list, otherwise False If white_list is empty: False if the file’s extension matches any in black_list, otherwise True
Return type: If file is a directory
-
sirepo.template.template_common.
filename_to_path
(files, source_lib)[source]¶ Returns full, unique paths of simulation files
Returns: py.path.local to files Return type: list
-
sirepo.template.template_common.
flatten_data
(d, res, prefix='')[source]¶ Takes a nested dictionary and converts it to a single level dictionary with flattened keys.
-
sirepo.template.template_common.
heatmap
(values, model, plot_fields=None)[source]¶ Computes a report histogram (x_range, y_range, z_matrix) for a report model.
-
sirepo.template.template_common.
histogram_bins
(nbins)[source]¶ Ensure the histogram count is in a valid range
-
sirepo.template.template_common.
lib_files
(data, source_lib=None)[source]¶ Return list of files used by the simulation
Parameters: data (dict) – sim db Returns: py.path.local to files Return type: list
-
sirepo.template.template_common.
model_defaults
(name, schema)[source]¶ Returns a set of default model values from the schema.
-
sirepo.template.template_common.
parse_animation_args
(data, key_map)[source]¶ Parse animation args according to key_map
Parameters: Returns: mapped animationArgs with version
Return type: Dict
-
sirepo.template.template_common.
parse_enums
(enum_schema)[source]¶ Returns a list of enum values, keyed by enum name.
-
sirepo.template.template_common.
render_jinja
(sim_type, v, name='parameters.py')[source]¶ Render the values into a jinja template.
Parameters: - sim_type (str) – application name
- v – flattened model data
Returns: source text
Return type:
-
sirepo.template.template_common.
report_parameters_hash
(data)[source]¶ Compute a hash of the parameters for his report.
Only needs to be unique relative to the report, not globally unique so MD5 is adequate. Long and cryptographic hashes make the cache checks slower.
Parameters: data (dict) – report and related models Returns: url safe encoded hash Return type: str
-
sirepo.template.template_common.
resource_dir
(sim_type)[source]¶ Where to get library files from
Parameters: sim_type (str) – application name Returns: absolute path to folder Return type: py.path.Local
-
sirepo.template.template_common.
validate_model
(model_data, model_schema, enum_info)[source]¶ Ensure the value is valid for the field type. Scales values as needed.
-
sirepo.template.template_common.
validate_models
(model_data, model_schema)[source]¶ Validate top-level models in the schema. Returns enum_info.
-
sirepo.template.template_common.
validate_safe_zip
(zip_file_name, target_dir='.', *args)[source]¶ Determine whether a zip file is safe to extract from
Performs the following checks:
- Each file must end up at or below the target directory
- Files must be 100MB or smaller
- If possible to determine, disallow “non-regular” and executable files
- Existing files cannot be overwritten
Parameters: - Throws:
- AssertionError if any test fails, otherwise completes silently
-
sirepo.template.template_common.
zip_path_for_file
(zf, file_to_find)[source]¶ Find the full path of the specified file within the zip.
- For a zip zf containing:
- foo1 foo2 bar/ bar/foo3
zip_path_for_file(zf, ‘foo3’) will return ‘bar/foo3’
Parameters: - zf (zipfile.ZipFile) – the zip file to examine
- file_to_find (str) – name of the file to find
Returns: The first path in the zip that matches the file name, or None if no match is found
sirepo.template.warppba module¶
sirepo.template.warpvnd module¶
sirepo.template.zgoubi module¶
zgoubi execution template.
copyright: | Copyright (c) 2018 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
sirepo.template.zgoubi_importer module¶
zgoubi datafile parser
copyright: | Copyright (c) 2018 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |
sirepo.template.zgoubi_parser module¶
zgoubi input file parser.
l:copyright: Copyright (c) 2018 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html
Module contents¶
Templates are used to configure codes
copyright: | Copyright (c) 2016 RadiaSoft LLC. All Rights Reserved. |
---|---|
license: | http://www.apache.org/licenses/LICENSE-2.0.html |