Tools module#
OpenCL module#
To use OpenCL architecture
Convertor#
- cherab.iter.tools.convertor.import_mesh(mesh_path, mesh_name, ext)#
- cherab.iter.tools.convertor.save_mesh(mesh, filename, ext)#
- cherab.iter.tools.convertor.relative_to_absolute_path(path)#
- cherab.iter.tools.convertor.main(mesh_path, new_ext)#
Rtm#
- class cherab.iter.tools.rtm.RTM#
- overwrite_material(wall, tungsten_roughness=0.29, beryllium_roughness=0.26, iron_roughness=0.13)#
- check_camera_attributes(camera, pixel_samples)#
- calculate_zsteps(nr, nz, mask)#
- create(camera, r, z, mask=None, wall=None, pixel_samples=2000, eps_rz=0.0001, integrate_step=0.0025, reflection=True)#
- load(filename)#
- get()#
- save(filename)#
- construct(emission)#
Slts#
- cherab.iter.tools.slts.slts(w_reflect, wo_reflect)#
Stray light to signal
Visualization#
- cherab.iter.tools.visualization.plot_fov_1D(theta, fovRad, unit='W/m$^3$')#
plotting field of view on 1D
- cherab.iter.tools.visualization.plot_fov_2D(phi, theta, fovRad)#
plotting field of view on 2D
- cherab.iter.tools.visualization.create_rtm_gif(r, z, rtm, phi, theta, fov_data, view_name='')#
Create RTM gif animation
- cherab.iter.tools.visualization.plot_2D_profile(data, fig=None, xlabel='$R$[m]', ylabel='$Z$[m]', clabel='[W/m$^3$]', ax_row=1, vmin=None, xdata=array([0, 1]), ydata=array([0, 1]), plot_mode='scalar', cmap='jet', titles=None, title_params={'bbox': {'edgecolor': (0.83, 0.83, 0.83, 0.9), 'facecolor': (0.83, 0.83, 0.83, 0.9)}, 'loc': 'left', 'va': 'top', 'x': 0.05, 'y': 0.95}, grids_params={'axes_pad': 0.0, 'cbar_location': 'right', 'cbar_mode': 'single', 'cbar_pad': 0.0, 'label_mode': 'L', 'share_all': True})#
plot several 2D profile data with one color bar In particular, plot a r-z plane rofile
- Parameters:
data (list[numpy.ndarray]) – list contains 2D numpy.ndarray data
xlabel (str) – x axis label, by default
"$R[m]"
ylabel (str) – y axis label, by default
"$Z[m]"
clabel (str) – color bar’s label, by default
"[W/m$^3$]"
ax_row (int) – the number of rows of axes displyed in 1 figure, by default 1
vmin (Optional[float]) – image scaling factor for a minimal value
xdata (ndarray) – x axis data, by default
np.array([0, 1])
ydata (ndarray) – y axis data, by default
np.array([0, 1])
plot_mode (str) – plotting mode to switch scalar or logarithum scale choosing either
'scalar'
or'log'
, by default'scalar'
cmap (str) – color map, by default
"jet"
titles (Optional[list[str]]) – list of axes titles, by default None
title_params –
set_title
’s parametersgrids_params –
ImageGrid
parameters
- Return type:
- cherab.iter.tools.visualization.plot_2D_data(data, fig=None, xlabel='x[px]', ylabel='y[px]', clabel='[W/m$^3$]', ax_row=1, vmin=None, extent=None, plot_mode='scalar', cmap='jet', titles=None, title_params={'bbox': {'edgecolor': (0.83, 0.83, 0.83, 0.9), 'facecolor': (0.83, 0.83, 0.83, 0.9)}, 'loc': 'left', 'va': 'top', 'x': 0.05, 'y': 0.95}, grids_params={'axes_pad': 0.0, 'cbar_location': 'right', 'cbar_mode': 'single', 'cbar_pad': 0.0, 'label_mode': 'L', 'share_all': True})#
plot several 2D profile data with one color bar In particular, plot a r-z plane rofile
- Parameters:
data (list[numpy.ndarray]) – list contains 2D numpy.ndarray data
xlabel (str) – x axis label, by default
"x[px]"
ylabel (str) – y axis label, by default
"y[px]"
clabel (str) – color bar’s label, by default
"[W/m$^3$]"
ax_row (int) – the number of rows of axes displyed in 1 figure, by default 1
vmin (Optional[float]) – image scaling factor for a minimal value
extent (Optional[tuple]) – image extent option, by default
(-0.5, numcols - 0.5, -0.5, numrows - 0.5)
plot_mode (str) – plotting mode to switch scalar or logarithum scale choosing either
'scalar'
or'log'
, by default'scalar'
cmap (str) – color map, by default
"jet"
titles (Optional[list[str]]) – list of axes titles, by default None
title_params –
set_title
’s parametersgrids_params –
ImageGrid
parameters
- Return type:
Xml#
- class cherab.iter.tools.xml.XmlDictConfig(parent_element)#
Bases:
dict
Example
tree = ElementTree.parse('your_file.xml') root = tree.getroot() xmldict = XmlDictConfig(root)
Or, if you want to use an XML string:
root = ElementTree.XML(xml_string) xmldict = XmlDictConfig(root)
And then use xmldict for what it is… a dict.
- cast(data_dict)#
- cherab.iter.tools.xml.str2bool(string)#
Convert “on”/”off” to True/False.
- cherab.iter.tools.xml.bool2str(flag)#
Convert True/False to “on”/”off”.
- cherab.iter.tools.xml.read_xml_entry(tree_element, rtype=None)#
Read xml entry.
- Parameters:
tree_element (
xml.etree.Element
) – xml tree element.rtype (any, optional) – type of return
- Returns:
Contents of entry’s ‘value’ attribute in one of Python formats.
- Return type:
rtype
- cherab.iter.tools.xml.parse_user_options(config)#
Parse user configuration.
- cherab.iter.tools.xml.parse_emission_lines(config)#
Parse list of emission lines.
- Parameters:
config (str) – Path co configuration file.
- Returns:
emission_lies - list of cherab.Line.
- Return type:
- Raises:
ValueError – If name of the element is not recognised.
- cherab.iter.tools.xml.parse_beam_geometry(config)#
Parse beam geometry.
Yml#
- cherab.iter.tools.yml.load_yml(config_file)#
- cherab.iter.tools.yml.dump_yml(dict_data, config_file)#