autocti.ArrayIrregular#
- class autocti.ArrayIrregular(values: Union[List, ndarray])[source]#
Bases:
StructureA collection of values which are structured as follows:
[value0, value1, value3]
The values object does not store the values as a list of floats, but instead a 1D NumPy array of shape [total_values]. This array can be mapped to the list of floats structure above. They are stored as a NumPy array so the values can be used efficiently for calculations.
The values input to this function can have any of the following forms:
[value0, value1]
In all cases, they will be converted to a list of floats followed by a 1D NumPy array.
Print methods are overridden so a user always “sees” the values as the list structure.
In contrast to a Array2D structure, ArrayIrregular do not lie on a uniform grid or correspond to values that originate from a uniform grid. Therefore, when handling irregular data-sets ArrayIrregular should be used.
- Parameters:
values ([float] or equivalent) – A collection of values.
Methods
allastypecopyflip_hdu_for_ds9Create a ArrayIrregular object from a .json file which stores the coordinates as a list of list of tuples.
Create a Grid2DIrregular object from a 2D ndarray array of values of shape [total_values, 2].
instance_flattenFlatten an instance of an autoarray class into a tuple of its attributes (i.e.
instance_unflattenUnflatten a tuple of attributes (i.e.
invertmaxminoutput_to_fitsOutput the grid to a .fits file.
Output this instance of the Grid2DIrregular object to a list of list of tuples.
reshapesqrtstructure_2d_fromstructure_2d_list_fromsumtrimmed_after_convolution_fromCreate a ArrayIrregular object from a 1D ndarray of values of shape [total_values].
with_new_arrayCopy this object but give it a new array.
Attributes
arrayderive_gridderive_indexesderive_maskdtypegeometryhdu_for_outputimagReturn the values in a list.
Returns the data structure in its native format which contains all unmaksed values to the native dimensions.
ndimoriginpixel_areapixel_scalepixel_scale_headerpixel_scalesrealshapeshape_nativeshape_slimsizeThe ArrayIrregular in their slim representation, a 1D ndarray of shape [total_values].
sub_shape_nativesub_shape_slimsub_sizetotal_areatotal_pixelsunmasked_grid- property native: Structure#
Returns the data structure in its native format which contains all unmaksed values to the native dimensions.
- property slim: ArrayIrregular#
The ArrayIrregular in their slim representation, a 1D ndarray of shape [total_values].
- values_from(array_slim: ndarray) ArrayIrregular[source]#
Create a ArrayIrregular object from a 1D ndarray of values of shape [total_values].
The returned values have an identical structure to this ArrayIrregular instance.
- Parameters:
array_slim – The 1D ndarray with (hape [total_values] whose values are mapped to a ArrayIrregular object.
- grid_from(grid_slim: np.ndarray) Grid2DIrregular[source]#
Create a Grid2DIrregular object from a 2D ndarray array of values of shape [total_values, 2].
The returned grid are structured following this ArrayIrregular instance.
- Parameters:
grid_slim – The 2d array (shape [total_coordinates, 2]) of (y,x) coordinates that are mapped to a Grid2DIrregular object.
- classmethod from_file(file_path: Union[Path, str]) ArrayIrregular[source]#
Create a ArrayIrregular object from a .json file which stores the coordinates as a list of list of tuples.
- Parameters:
file_path – The path to the coordinates .dat file containing the coordinates (e.g. ‘/path/to/coordinates.dat’)
- output_to_json(file_path: Union[Path, str], overwrite: bool = False)[source]#
Output this instance of the Grid2DIrregular object to a list of list of tuples.
- Parameters:
file_path – The path to the coordinates .dat file containing the coordinates (e.g. ‘/path/to/coordinates.dat’)
overwrite – If there is as exsiting file it will be overwritten if this is True.