nabu.pipeline.helical.gridded_accumulator module

class nabu.pipeline.helical.gridded_accumulator.GriddedAccumulator(gridded_radios, gridded_weights, diagnostic_radios, diagnostic_weights, diagnostic_angles, diagnostic_searched_angles_rad_clipped, diagnostic_zpix_transl, diag_zpro_run=0, dark=None, flat_indexes=None, flats=None, weights=None, double_flat=None, radios_srcurrent=None, flats_srcurrent=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

  • diag_zpro_run (int) – if > 0 then only the diagnostics are filled, and no accumulation is done

  • diagnostic_searched_angles_rad_clipped – the angles between 0 and 2pi. The contributions to diagnostic will be searched for these angles plus for the same angles + 2pi ( following turn)

  • diagnostic_radios (3d np.array, a stack composed of) – 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 radios will collect the transformed data for the angles given by diagnostic_searched_angles_rad_clipped and redundancy

  • 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*len(diagnostic_searched_angles_rad_clipped),). The entries will be filled with the angles at which the contributions to diagnostic_radios have been summed.

  • diagnostic_zpix_transl (1D np.array) – same as for diagnostic_angles, but for vertical translation in pixels

  • dark (None or 2D np.array) – 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.

  • radios_srcurrent (1D np.array) – the machine current for every radio

  • flats_srcurrent (1D np.array) – the machine current for every flat

flat_indexes: None or a list of integers

the projection index corresponding to the flats

flatsNone 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.

weightsNone 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.

double_flat = None or 2D np.array

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

nominal_current = 0.2
extract_preprocess_with_flats(subchunk_slice, subchunk_file_indexes, chunk_info, subr_start_end, dtasrc_start_end, data_raw, radios_angular_range_slicing)[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

  • radios_angular_range_slicing – my_subsampled_indexes is important in order to compare the radios positions with respect to the flat position, and these position are given as the sequential acquisition number which counts everything ( flats, darks, radios ) Insteqd, in order to access array which spans only the radios, we need to have an idea of where we are. this is provided by radios_angular_range_slicing which addresses the radios domain

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, so far used only by the unit test, 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.