[docs]classBaseBlock(BlockData,BlockTransfer):""" Base block class providing default implementations for the data transferring/getting/setting behaviour needed for a block type to be processed by implementors of `MethodWrapper`. Ie, this class provides default implementations for the `BlockTransfer` and `BlockData` protocols. Note that the data indexing behaviour described in `DataIndexing` is not implemented in this class. If the default implementations for data transferring/getting/setting in this class are acceptable: inherit from `BaseBlock`, override where necessary, and implement `DataIndexing` in order to implement the `Block` protocol. """def__init__(self,data:np.ndarray,aux_data:AuxiliaryData)->None:self._data=dataself._aux_data=aux_datadef__dir__(self)->list[str]:"""Return only those properties that are relevant for the data"""return["data","angles","angles_radians","darks","flats","dark","flat"]@propertydefdata(self)->generic_array:returnself._data@data.setterdefdata(self,new_data:generic_array):self._data=new_data@propertydefaux_data(self)->AuxiliaryData:returnself._aux_datadef_empty_aux_array(self):empty_shape=list(self._data.shape)returnnp.empty_like(self._data,shape=empty_shape)@propertydefangles(self)->np.ndarray:returnself._aux_data.get_angles()@angles.setterdefangles(self,new_angles:np.ndarray):self._aux_data.set_angles(new_angles)@propertydefangles_radians(self)->np.ndarray:returnself.angles@angles_radians.setterdefangles_radians(self,new_angles:np.ndarray):self.angles=new_angles@propertydefdarks(self)->generic_array:darks=self._aux_data.get_darks(self.is_gpu)ifdarksisNone:darks=self._empty_aux_array()returndarks@darks.setterdefdarks(self,darks:generic_array):self._aux_data.set_darks(darks)# alias@propertydefdark(self)->generic_array:returnself.darks@dark.setterdefdark(self,darks:generic_array):self.darks=darks@propertydefflats(self)->generic_array:flats=self._aux_data.get_flats(self.is_gpu)ifflatsisNone:flats=self._empty_aux_array()returnflats@flats.setterdefflats(self,flats:generic_array):self._aux_data.set_flats(flats)# alias@propertydefflat(self)->generic_array:returnself.flats@flat.setterdefflat(self,flats:generic_array):self.flats=flats@propertydefshape(self)->Tuple[int,int,int]:"""Shape of the data in this block"""returnmake_3d_shape_from_array(self._data)