nabu.pipeline.helical.gridded_accumulator module

class nabu.pipeline.helical.gridded_accumulator.GriddedAccumulator(gridded_radios, gridded_weights, diagnostic_radios, diagnostic_weights, diagnostic_angles, dark=None, flat_indexes=None, flats=None, weights=None, double_flat=None)[source]

Bases: object

This class creates, for a selected volume slab, a standard set of radios from an helical dataset.

Parameters:
  • gridded_radios (3D np.array) – this is the stack of new radios which will be resynthetised, by this class, for a selected slab. The object is initialised with this array, and this array will accumulate, during subsequent calls to method extract_preprocess_with_flats, the sum of the transformed contributions obtained from the arguments of the mentioned method (extract_preprocess_with_flats).

  • gridded_weights (3d np.array) – same shape as gridded_radios, but it will accumulate the weights, during calls to extract_preprocess_with_flats

  • diagnostic_radios (3d np.array, a stack composed of two radios) – each radio must have the same size as a radio of the gridded_radios argument. During the calls to extract_preprocess_with_flats methods, the first radio will collect the transformed data for angle=0 ( and the neighbouring ones according to angular interpolation coefficients) and this only for the first occurring turn. The second radio will be initialised at the second turn, if any. These array are meant to be used to check the translation step over one turn.

  • diagnostic_weights (3d np.array a stack composed of two radios) – Same shape as diagnostic_radios. The weigths for diagnostic radios ( will be zero on pixel where no data is available, or where the weight is null)

  • diagnostic_angles (1D np.array) – Must have shape==(2,). The two entries will be filled with the angles at which the contributions to diagnostic_radios have been summed.

  • np.array (double_flat = None or 2D) – must have the shape of the detector ( generally larger that a radio of gridded_radios) If given, the dark will be subtracted from data and flats.

  • flat_indexes (None or a list of integers) – the projection index corresponding to the flats

  • flats (None or 3D np.array) – the stack of flats. Each flat must have the shape of the detector (generally larger that a radio of gridded_radios) The flats, if given, are subtracted of the dark, if given, and the result is used to normalise the data.

  • weights (None or 2D np.array) – If not given each data pixel will be considered with unit weight. If given it must have the same shape as the detector.

  • np.array – If given, the double flat will be applied (division by double_flat) Must have the same shape as the detector.

extract_preprocess_with_flats(subchunk_slice, subchunk_file_indexes, chunk_info, subr_start_end, dtasrc_start_end, data_raw)[source]

This functions is meant to be called providing, each time, a subset of the data which are needed to reconstruct a chunk (to reconstruct a slab). When all the necessary data have flown through the subsequent calls to this method, the accumulators are ready.

Parameters:
  • subchunk_slice (an object of the python class "slice") – this slice slices the angular domain which corresponds to the useful projections which are useful for the chunk, and whose informations are contained in the companion argument “chunk_info” Such slicing correspond to the angular subset, for which we are providing data_raw

  • subchunk_file_indexes (a sequence of integers.) – they correspond to the projection numbers from which the data in data_raw are coming. They are used to interpolate between falt fields

  • chunk_info (an object returned by the get_chunk_info of the SpanStrategy class) –

    this object must have the following members, which relates to the wanted chunk

    angle_index_span: a pair of integers indicating the start and the end of useful angles

    in the array of all the scan angle self.projection_angles_deg

    span_v: a pair of two integers indicating the start and end of the span relatively to the lowest value

    of array self.total_view_heights

    integer_shift_v: an array, containing for each one of the useful projections of the span,

    the integer part of vertical shift to be used in cropping,

    fract_complement_to_integer_shift_v :

    the fractional remainder for cropping.

    z_pix_per_proj: an array, containing for each to be used projection of the span

    the vertical shift

    x_pix_per_proj: ….the horizontal shift

    angles_rad : an array, for each useful projection of the chunk the angle in radian

  • subr_start_end (a pair of integers) – the start height, and the end height, of the slab for which we are collecting the data. The number are given with the same logic as for member span_v of the chunk_info. Without the phase margin, when the phase margin is zero, hey would correspond exactly to the start and end, vertically, of the reconstructed slices.

  • dtasrc_start_end (a pair of integers) – This number are relative to the detector ( they are detector line indexes). They indicated, vertically, the detector portion the data_raw data correspond to

  • data_raw (np.array 3D) – the data which correspond to a limited detector stripe and a limited angular subset

nabu.pipeline.helical.gridded_accumulator.overlap_logic(subr_start_z, subr_end_z, dtasrc_start_z, dtasrc_end_z)[source]

determines the useful lines which can be transferred from the dtasrc_start_z:dtasrc_end_z range targeting the range subr_start_z: subr_end_z ………………

nabu.pipeline.helical.gridded_accumulator.padding_logic(subr_start_z, subr_end_z, dtasrc_start_z, dtasrc_end_z)[source]

………. and the missing ranges which possibly could be obtained by extension padding

nabu.pipeline.helical.gridded_accumulator.get_reconstruction_space(span_info, min_scanwise_z, end_scanwise_z, phase_margin_pix)[source]

Utility function which, given the span_info object, creates the auxiliary collection arrays and initialises the my_z_min, my_z_end variable keeping into account the scan direction and the min_scanwise_z, end_scanwise_z input arguments :param span_info: :type span_info: SpanStrategy :param min_scanwise_z: non negative number, where zero indicates the first feaseable slice doable scanwise.

Indicates the first (scanwise) requested slice to be reconstructed

Parameters:

end_scanwise_z (int) – non negative number, where zero indicates the first feaseable slice doable scanwise. Indicates the end (scanwise) slice which delimity the to be reconstructed requested slab.