ecpi.common.instru.array_convention module

Section author: ECLAIRs GP team

Array convention to pass indices to cell positions.

ECLAIRs general program pipeline convention (yzegp) of 2D array:

yzegp used cartesian convention where :

  • first coordinate is the position on horizontal axis, same as y axis in ECL_Los frame defined by CNES

  • second coordinate is the position on vertical axis, same as z axis in ECL_Los frame defined by CNES

  • so shield ECLAIRs is at the bottom and origin of epg is always in left corner

  • the value is associated to “pixel” that has the lower left corner at (y,z)

Note

Cartesian convention is use everywhere in ecpi library. Mainly used with class ArraySquareCell to define sub-mask and detector geometry InstruECLAIRs in ECL_Los frame

example : a_epg[1,2] = 1

 z axis (same direction that z_ECCLos)

  ^
  |
  |
3 + +-+
  | |1|
2 + +-+
  |
1 +
  |
0 +-+-+-+----> y axis (same direction that y_ECCLos)
  0 1 2 3
 +---------------------+
 |    SHIELD ECLAIRs   |
 +---------------------+

ijDet convention of 2D array:

ijDet used row, column convention where :

  • ‘i’ first coordinate is the row number along direction like z axis in ECLLos frame defined by CNES

  • ‘j’ second coordinate is the column number along direction like inverse of y axis in ECLLos frame defined by CNES

  • so shield ECLAIRs is at the bottom and origin of ijDet is always in right corner

Example : a_epg[1,2] = 1

                   i
                   ^
                   | 2
             +-+   +
             |1|   | 1
             +-+   +
                   | 0
   j    <----+-+-+-+
              2 1 0
+---------------------+
|    SHIELD ECLAIRs   |
+---------------------+

Note

ijDet is only use for input and output data file requiring an “array detector convention”

Summary

Functions:

ijdet_to_ndet

Convert coordinate in ijdet convention to ndet convention

ijdet_to_yzegp

convert couple index in ijdet convention to yzegp convention

ijdet_to_yzegp_array

convert array 2D in ijdet convention to yzegp convention

ijdet_to_yzegp_array_slow

convert array 2D in ijdet convention to yzegp convention

ndet_to_ijdet

Convert coordinate in ndet convention to ijdet convention

ndet_to_yzegp

Convert coordinate in ndet convention to yzegp convention

ndet_to_yzegp_array

Convert ndet array into a matrix in yzegp convention

plot_ecllos

param array_yzegp

in ecpi convention (see below)

plot_ijdet

param array_yzegp

in ecpi convention (see below)

yzegp_to_ijdet

convert couple index in yzegp convention to ijdet convention

yzegp_to_ijdet_array

convert array 2D in yzegp convention to ijdet convention

yzegp_to_ndet

Convert couple index in yzegp convention to ndet convention

yzegp_to_ndet_array

Convert yzegp pixel matrix into a ndet vector

Reference

ijdet_to_ndet(idet, jdet, idx_max=79)[source]

Convert coordinate in ijdet convention to ndet convention

Parameters
  • idet (integer) – first coordinate of the ijdet system

  • jdet (integer) – second coordinate of the ijdet system

  • idx_max (integer) – index maximum (i.e MAX - 1)

Returns

pixel number in the NDET system

Return type

integer [0, 6399]

ijdet_to_yzegp(idet, jdet, idx_max=79)[source]

convert couple index in ijdet convention to yzegp convention

Parameters
  • idet (integer) – first coordinate of ijdet

  • jdet (integer) – second coordinate of ijdet

  • idx_max (integer) – index max (ie MAX-1)

ijdet_to_yzegp_array(a_ijdet)[source]

convert array 2D in ijdet convention to yzegp convention

Parameters

a_ijdet (numpy 2D array) – array in ijdet convention

ijdet_to_yzegp_array_slow(a_ijdet)[source]

convert array 2D in ijdet convention to yzegp convention

Parameters

a_ijdet (numpy 2D array) – array in ijdet convention

ndet_to_ijdet(ndet, idx_max=79)[source]

Convert coordinate in ndet convention to ijdet convention

Parameters
  • ndet (integer [0, 6399]) – pixel number in the NDET system

  • idx_max (integer) – index maximum (i.e MAX - 1)

Returns

  • integer – first coordinate of the ijdet system

  • integer – second coordinate of the ijdet system

ndet_to_yzegp(ndet, idx_max=79)[source]

Convert coordinate in ndet convention to yzegp convention

Parameters
  • ndet (integer [0, 6399]) – pixel number in the NDET system

  • idx_max – index maximum (i.e MAX - 1)

Returns

  • integer – first coordinate of the yzegp system

  • integer – second coordinate of the yzegp system

ndet_to_yzegp_array(ndet)[source]

Convert ndet array into a matrix in yzegp convention

Parameters

ndet (array [0, 6399]) – pixel list (or 1d array) in NDET format

Returns

pixel matrix in the the yzegp system

Return type

matrix

plot_ecllos(array_yzegp, mes='')[source]
Parameters
  • array_yzegp – in ecpi convention (see below)

  • mes – message for title

plot_ijdet(array_yzegp, mes='')[source]
Parameters
  • array_yzegp – in ecpi convention (see below)

  • mes – message for title

yzegp_to_ijdet(y_gp, z_gp, idx_max=79)[source]

convert couple index in yzegp convention to ijdet convention

Parameters
  • y_gp (integer) – first coordinate of yzegp

  • z_gp – second coordinate of yzegp

:type z_gp:integer :param idx_max: index max (ie MAX-1) :type idx_max:integer

yzegp_to_ijdet_array(a_gpidx)[source]

convert array 2D in yzegp convention to ijdet convention

Parameters

a_gpidx (numpy 2D array) – array in yzegp convention

yzegp_to_ndet(yegp, zegp, idx_max=79)[source]

Convert couple index in yzegp convention to ndet convention

Parameters
  • yegp (integer) – first coordinate of the yzegp system

  • zegp (integer) – second coordinate of the yzegp system

  • idx_max (integer) – index maximum (i.e MAX - 1)

Returns

pixel number in the NDET system

Return type

integer [0, 6399]

yzegp_to_ndet_array(yzegp)[source]

Convert yzegp pixel matrix into a ndet vector

Parameters

yzegp (float matrix (80,80)) – pixel matrix in the yzegp system

Returns

pixel number in the NDET system

Return type

1d array [0, 6399]