Tosca

class zgoubidoo.commands.fieldmaps.Tosca(label1: str = '', label2: str = '', *params, **kwargs)[source]

Bases: zgoubidoo.commands.magnetique.CartesianMagnet

2-D and 3-D Cartesian or cylindrical mesh field map.

Zgoubi manual description

TOSCA is dedicated to the reading and treatment of 2-D or 3-D Cartesian or cylindrical mesh field maps as delivered by the TOSCA magnet computer code standard parent.

A pair of flags, MOD, MOD2, determine whether Cartesian or Z-axis cylindrical mesh is used, and the nature of the field map data set.

The total number of field data files to be read is determined by the MOD flag (see below) and by the parameter IZ that appears in the data list following the keyword. Each of these files contains the field components BX,BY,BZonan(X,Y)mesh.IZ=1fora2-Dmap,andinthiscaseBXandBY are assumed zero all over the map7.

For a 3-D map with mid-block symmetry, described with a set of 2-D maps at various Z, then MOD=0 and IZ ≥ 2, and thus, the first data file whose name follows in the data list is supposed to contain the median block field (assuming Z = 0 and BX = BY = 0), while the remaining IZ − 1 file(s) contain the IZ − 1 additional planes in increasing Z order.

For arbitrary 3-D maps, no symmetry assumed, then MOD=1 and the total number of maps (whose names follow in the data list) is IZ, such that map number [IZ/2] + 1 is the Z = 0 elevation one.

The field map data file has to be be filled with a format that fits the FORTRAN reading sequence.

IX (JY , KZ) is the number of longitudinal (transverse horizontal, vertical) nodes of the 3-D uniform mesh. For letting zgoubi know that these are binary files, FNAME must begin with ‘B ’ or ‘b ’. In addition to the MOD=1, 2 cases above, one can have MOD=12 and in that case a single file contains the all 3-D field map. See table below and the FORTRAN subroutine fmapw.f and its entries FMAPR, FMAPR2, for more details, in particular the formatting of the field map data file(s).

The field B = (BX , BY , BZ ) is normalized by means of BNORM in a similar way as in CARTEMES. As well the coordinates X and Y (and Z in the case of a 3-D field map) are normalized by the X-[, Y-, Z-]NORM coefficient (useful to convert to centimeters, the working units in zgoubi).

At each step of the trajectory of a particle inside the map, the field and its derivatives are calculated

  • in the case of 2-D map, by means of a second or fourth order polynomial interpolation, depending

    on IORDRE (IORDRE = 2, 25 or 4), as for CARTEMES,

  • in the case of 3-D map, by means of a second order polynomial interpolation with a 3 × 3 × 3-point

    parallelepipedic grid, as described in section 1.4.4.

Entrance and/or exit integration boundaries between which the trajectories are integrated in the field may be defined, in the same way as in CARTEMES.

Zgoubidoo usage and example

Command attributes

LABEL1=''

Primary label for the Zgoubi command (default: auto-generated hash).

Type

str

LABEL2=''

Secondary label for the Zgoubi command.

Type

str

HEIGHT='20 centimeter'

Height of the magnet (distance between poles), used by plotting functions.

Type

Quantity

POLE_WIDTH='30 centimeter'

Pole width (used for plotting only).

Type

Quantity

PIPE_THICKNESS='2 centimeter'

Thickness of the pipe, used by plotting functions.

Type

Quantity

PIPE_COLOR='grey'

Color of the pipe, used by plotting functions.

Type

str

REFERENCE_FIELD_COMPONENT='BZ'

Orientation of the reference field (used by field maps)

Type

str

KINEMATICS='None'

A kinematics object.

Type

NoneType

APERTURE_LEFT='10 centimeter'

Aperture size of the magnet, left side (used for plotting only).

Type

Quantity

APERTURE_RIGHT='10 centimeter'

Aperture size of the magnet, right side (used for plotting only).

Type

Quantity

APERTURE_TOP='10 centimeter'

Aperture size of the magnet, top side (used for plotting only).

Type

Quantity

APERTURE_BOTTOM='10 centimeter'

Aperture size of the magnet, bottom side (used for plotting only).

Type

Quantity

COLOR='black'

Magnet color for plotting.

Type

str

LENGTH_IS_ARC_LENGTH='False'
Type

bool

IC='2'

Print the map.

Type

int

IL='2'

Print field and coordinates along trajectories.

Type

int

BNORM='1.0'

Field normalization coefficient.

Type

float

XN='1.0'

X coordinate normalization coefficient.

Type

float

YN='1.0'

Y coordinate normalization coefficient.

Type

float

ZN='1.0'

Z coordinate normalization coefficient.

Type

float

TITL='FIELDMAP'

Title.

Type

str

IX='1'

Number of nodes of the mesh in the X direction.

Type

int

IY='1'

Number of nodes of the mesh in the Y direction.

Type

int

IZ='1'

Number of nodes of the mesh in the Z direction.

Type

int

MOD='0'

Format reading mode.

Type

int

MOD2='0'

Format reading sub-mode.

Type

int

FNAME='TOSCA'

File names.

Type

str

ID='0'

Integration boundary.

Type

int

IORDRE='25'

Degree of interpolation polynomial.

Type

int

XPAS='1 millimeter'

Integration step.

Type

Quantity

KPOS='2'

Alignment parameter

Type

int

XCE='0 centimeter'
Type

Quantity

YCE='0 centimeter'
Type

Quantity

ALE='0 radian'
Type

Quantity

Default initializer for all Commands.

Attributes Summary

KEYWORD

Keyword of the command used for the Zgoubi input data.

PARAMETERS

Parameters of the command, with their default value, their description and optinally an index used by other commands (e.g.

entry_patched

Returns:

exit

Returns:

exit_patched

Returns:

length

Returns:

rotation

Returns:

x_offset

Returns:

y_offset

Returns:

Methods Summary

adjust_tracks_variables(tracks)

load([zgoubi])

plotly()

Returns:

process_output(output, parameters, zgoubi_input)

param output

Attributes Documentation

KEYWORD: str = 'TOSCA'

Keyword of the command used for the Zgoubi input data.

PARAMETERS: dict = {'A': (1,), 'ALE': (<Quantity(0, 'radian')>, ''), 'APERTURE_BOTTOM': (<Quantity(10, 'centimeter')>, 'Aperture size of the magnet, bottom side (used for plotting only).'), 'APERTURE_LEFT': (<Quantity(10, 'centimeter')>, 'Aperture size of the magnet, left side (used for plotting only).'), 'APERTURE_RIGHT': (<Quantity(10, 'centimeter')>, 'Aperture size of the magnet, right side (used for plotting only).'), 'APERTURE_TOP': (<Quantity(10, 'centimeter')>, 'Aperture size of the magnet, top side (used for plotting only).'), 'B': (1,), 'BNORM': (1.0, 'Field normalization coefficient.'), 'C': (1,), 'COLOR': ('black', 'Magnet color for plotting.'), 'FNAME': ('TOSCA', 'File names.'), 'HEIGHT': (<Quantity(20, 'centimeter')>, 'Height of the magnet (distance between poles), used by plotting functions.'), 'IC': (2, 'Print the map.'), 'ID': (0, 'Integration boundary.'), 'IL': (2, 'Print field and coordinates along trajectories.'), 'IORDRE': (25, 'Degree of interpolation polynomial.'), 'IX': (1, 'Number of nodes of the mesh in the X direction.'), 'IY': (1, 'Number of nodes of the mesh in the Y direction.'), 'IZ': (1, 'Number of nodes of the mesh in the Z direction.'), 'KINEMATICS': (None, 'A kinematics object.'), 'KPOS': (2, 'Alignment parameter'), 'LABEL1': ('', 'Primary label for the Zgoubi command (default: auto-generated hash).'), 'LABEL2': ('', 'Secondary label for the Zgoubi command.'), 'LENGTH_IS_ARC_LENGTH': (False, ''), 'MOD': (0, 'Format reading mode.'), 'MOD2': (0, 'Format reading sub-mode.'), 'PIPE_COLOR': ('grey', 'Color of the pipe, used by plotting functions.'), 'PIPE_THICKNESS': (<Quantity(2, 'centimeter')>, 'Thickness of the pipe, used by plotting functions.'), 'POLE_WIDTH': (<Quantity(30, 'centimeter')>, 'Pole width (used for plotting only).'), 'RE': (0,), 'REFERENCE_FIELD_COMPONENT': ('BZ', 'Orientation of the reference field (used by field maps)'), 'RS': (0,), 'TE': (0,), 'TITL': ('FIELDMAP', 'Title.'), 'TS': (0,), 'XCE': (<Quantity(0, 'centimeter')>, ''), 'XN': (1.0, 'X coordinate normalization coefficient.'), 'XPAS': (<Quantity(1, 'millimeter')>, 'Integration step.'), 'YCE': (<Quantity(0, 'centimeter')>, ''), 'YN': (1.0, 'Y coordinate normalization coefficient.'), 'ZN': (1.0, 'Z coordinate normalization coefficient.')}

Parameters of the command, with their default value, their description and optinally an index used by other commands (e.g. fit).

entry_patched

Returns:

exit

Returns:

exit_patched

Returns:

length

Returns:

rotation

Returns:

x_offset

Returns:

y_offset

Returns:

Methods Documentation

adjust_tracks_variables(tracks: pandas.core.frame.DataFrame)[source]
load(zgoubi: Optional[zgoubidoo.zgoubi.Zgoubi] = None)[source]
plotly()[source]

Returns:

process_output(output: List[str], parameters: Mapping[str, Union[_Q, float]], zgoubi_input: _Input) → bool[source]
Parameters
  • output

  • parameters

  • zgoubi_input

Returns: