Remap methods (sarpy.visualization.remap)¶
Provides common methods for remapping a complex or other array to 8 or 16-bit image type arrays.
Note: The original function and 8-bit implementation has been replaced with a class based solution which allows state variables associated with the remap function, and support for 16-bit versions, as well as an 8-bit MA, RGB or RGBA lookup tables.
- sarpy.visualization.remap.clip_cast(array: ndarray, dtype: str | dtype | number = 'uint8', min_value: None | int | float = None, max_value: None | int | float = None) ndarray ¶
Cast by clipping values outside of valid range, rather than truncating.
- Parameters:
array (numpy.ndarray) –
dtype (str|numpy.dtype) –
min_value (None|int|float) –
max_value (None|int|float) –
- Return type:
numpy.ndarray
- sarpy.visualization.remap.amplitude_to_density(data: ndarray, dmin: int | float = 30, mmult: int | float = 40, data_mean: None | int | float = None) ndarray ¶
Convert to density data for remap.
This is a digested version of contents presented in a 1994 pulication entitled “Softcopy Display of SAR Data” by Kevin Mangis. It is unclear where this was first published or where it may be publicly available.
- Parameters:
data (numpy.ndarray) – The (presumably complex) data to remap
dmin (float|int) – A dynamic range parameter. Lower this widens the range, will raising it narrows the range. This was historically fixed at 30.
mmult (float|int) – A contrast parameter. Low values will result is higher contrast and quicker saturation, while high values will decrease contrast and slower saturation. There is some balance between the competing effects in the dmin and mmult parameters.
data_mean (None|float|int) – The data mean (for this or the parent array for continuity), which will be calculated if not provided.
- Return type:
numpy.ndarray
- class sarpy.visualization.remap.RemapFunction(override_name: str | None = None, bit_depth: int = 8, dimension: int = 0)¶
Bases:
object
Abstract remap class which is callable.
See the
call()
implementation for the given class to understand what specific keyword arguments are allowed for the specific instance.- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- property are_global_parameters_set: bool¶
Are (all) global parameters used for applying this remap function set? This should return True if there are no global parameters.
- Type:
bool
- raw_call(data: ndarray, **kwargs) ndarray ¶
This performs the mapping from input data to output floating point version, this is directly used by the
call()
method.- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
kwargs – Some keyword arguments may be allowed here
- Returns:
This should generally have float64 dtype.
- Return type:
numpy.ndarray
- call(data: ndarray, **kwargs) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable, as follows:>>> remap = RemapFunction() >>> discrete_data = remap(data, **kwargs)
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
kwargs – Some keyword arguments may be allowed here
- Return type:
numpy.ndarray
- calculate_global_parameters_from_reader(reader: SICDTypeReader, index: int = 0, pixel_bounds: None | Tuple | List | ndarray = None)¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- class sarpy.visualization.remap.MonochromaticRemap(override_name: str | None = None, bit_depth: int = 8, max_output_value: int | None = None)¶
Bases:
RemapFunction
Abstract monochromatic remap class.
- property max_output_value: int¶
The (read-only) maximum output value size.
- Type:
int
- raw_call(data, **kwargs)¶
This performs the mapping from input data to output floating point version, this is directly used by the
call()
method.- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
kwargs – Some keyword arguments may be allowed here
- Returns:
This should generally have float64 dtype.
- Return type:
numpy.ndarray
- calculate_global_parameters_from_reader(reader, index=0, pixel_bounds=None)¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- property are_global_parameters_set: bool¶
Are (all) global parameters used for applying this remap function set? This should return True if there are no global parameters.
- Type:
bool
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- call(data: ndarray, **kwargs) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable, as follows:>>> remap = RemapFunction() >>> discrete_data = remap(data, **kwargs)
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
kwargs – Some keyword arguments may be allowed here
- Return type:
numpy.ndarray
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- class sarpy.visualization.remap.Density(override_name: str | None = None, bit_depth: int = 8, max_output_value: int | None = None, dmin: float | int = 30, mmult: float | int = 40, eps: float = 1e-05, data_mean: None | int | float = None)¶
Bases:
MonochromaticRemap
A monochromatic logarithmic density remapping function.
This is a digested version of contents presented in a 1994 publication entitled “Softcopy Display of SAR Data” by Kevin Mangis. It is unclear where this was first published or where it may be publicly available.
- property dmin: float¶
The dynamic range parameter. This is read-only.
- Type:
float
- property mmult: float¶
The contrast parameter. This is read only.
- Type:
float
- property data_mean: float | None¶
The data mean for global use.
- Type:
None|float
- property are_global_parameters_set: bool¶
Is the global parameters used for applying this remap function set? In this case, this is the data_mean property.
- Type:
bool
- raw_call(data: ndarray, data_mean: float | None = None) ndarray ¶
This performs the mapping from input data to output floating point version, this is directly used by the
call()
method.- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
data_mean (None|float) – The pre-calculated data mean, for consistent global use. The order of preference is the value provided here, the class data_mean property value, then the value calculated from the present sample.
- Return type:
numpy.ndarray
- call(data: ndarray, data_mean: float | None = None) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable, as follows:>>> remap = Density() >>> discrete_data = remap(data, data_mean=85.2)
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
data_mean (None|float) – The pre-calculated data mean, for consistent global use. The order of preference is the value provided here, the class data_mean property value, then the value calculated from the present sample.
- Return type:
numpy.ndarray
- calculate_global_parameters_from_reader(reader: SICDTypeReader, index: int = 0, pixel_bounds: None | tuple | list | ndarray = None)¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property max_output_value: int¶
The (read-only) maximum output value size.
- Type:
int
- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- class sarpy.visualization.remap.Brighter(override_name: str | None = None, bit_depth: int = 8, max_output_value: int | None = None, eps: float = 1e-05, data_mean: None | int | float = None)¶
Bases:
Density
The density remap using parameters for brighter results.
- property are_global_parameters_set: bool¶
Is the global parameters used for applying this remap function set? In this case, this is the data_mean property.
- Type:
bool
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- calculate_global_parameters_from_reader(reader: SICDTypeReader, index: int = 0, pixel_bounds: None | tuple | list | ndarray = None)¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- call(data: ndarray, data_mean: float | None = None) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable, as follows:>>> remap = Density() >>> discrete_data = remap(data, data_mean=85.2)
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
data_mean (None|float) – The pre-calculated data mean, for consistent global use. The order of preference is the value provided here, the class data_mean property value, then the value calculated from the present sample.
- Return type:
numpy.ndarray
- property data_mean: float | None¶
The data mean for global use.
- Type:
None|float
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property dmin: float¶
The dynamic range parameter. This is read-only.
- Type:
float
- property max_output_value: int¶
The (read-only) maximum output value size.
- Type:
int
- property mmult: float¶
The contrast parameter. This is read only.
- Type:
float
- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- raw_call(data: ndarray, data_mean: float | None = None) ndarray ¶
This performs the mapping from input data to output floating point version, this is directly used by the
call()
method.- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
data_mean (None|float) – The pre-calculated data mean, for consistent global use. The order of preference is the value provided here, the class data_mean property value, then the value calculated from the present sample.
- Return type:
numpy.ndarray
- class sarpy.visualization.remap.Darker(override_name: str | None = None, bit_depth: int = 8, max_output_value: int | None = None, eps: float = 1e-05, data_mean: None | int | float = None)¶
Bases:
Density
The density remap using parameters for darker results.
- property are_global_parameters_set: bool¶
Is the global parameters used for applying this remap function set? In this case, this is the data_mean property.
- Type:
bool
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- calculate_global_parameters_from_reader(reader: SICDTypeReader, index: int = 0, pixel_bounds: None | tuple | list | ndarray = None)¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- call(data: ndarray, data_mean: float | None = None) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable, as follows:>>> remap = Density() >>> discrete_data = remap(data, data_mean=85.2)
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
data_mean (None|float) – The pre-calculated data mean, for consistent global use. The order of preference is the value provided here, the class data_mean property value, then the value calculated from the present sample.
- Return type:
numpy.ndarray
- property data_mean: float | None¶
The data mean for global use.
- Type:
None|float
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property dmin: float¶
The dynamic range parameter. This is read-only.
- Type:
float
- property max_output_value: int¶
The (read-only) maximum output value size.
- Type:
int
- property mmult: float¶
The contrast parameter. This is read only.
- Type:
float
- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- raw_call(data: ndarray, data_mean: float | None = None) ndarray ¶
This performs the mapping from input data to output floating point version, this is directly used by the
call()
method.- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
data_mean (None|float) – The pre-calculated data mean, for consistent global use. The order of preference is the value provided here, the class data_mean property value, then the value calculated from the present sample.
- Return type:
numpy.ndarray
- class sarpy.visualization.remap.High_Contrast(override_name: str | None = None, bit_depth: int = 8, max_output_value: int | None = None, eps: float = 1e-05, data_mean: None | int | float = None)¶
Bases:
Density
The density remap using parameters for high contrast results.
- property are_global_parameters_set: bool¶
Is the global parameters used for applying this remap function set? In this case, this is the data_mean property.
- Type:
bool
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- calculate_global_parameters_from_reader(reader: SICDTypeReader, index: int = 0, pixel_bounds: None | tuple | list | ndarray = None)¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- call(data: ndarray, data_mean: float | None = None) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable, as follows:>>> remap = Density() >>> discrete_data = remap(data, data_mean=85.2)
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
data_mean (None|float) – The pre-calculated data mean, for consistent global use. The order of preference is the value provided here, the class data_mean property value, then the value calculated from the present sample.
- Return type:
numpy.ndarray
- property data_mean: float | None¶
The data mean for global use.
- Type:
None|float
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property dmin: float¶
The dynamic range parameter. This is read-only.
- Type:
float
- property max_output_value: int¶
The (read-only) maximum output value size.
- Type:
int
- property mmult: float¶
The contrast parameter. This is read only.
- Type:
float
- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- raw_call(data: ndarray, data_mean: float | None = None) ndarray ¶
This performs the mapping from input data to output floating point version, this is directly used by the
call()
method.- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
data_mean (None|float) – The pre-calculated data mean, for consistent global use. The order of preference is the value provided here, the class data_mean property value, then the value calculated from the present sample.
- Return type:
numpy.ndarray
- class sarpy.visualization.remap.Linear(override_name: str | None = None, bit_depth: int = 8, max_output_value: int | None = None, min_value: None | int | float = None, max_value: None | int | float = None)¶
Bases:
MonochromaticRemap
A monochromatic linear remap function.
- property min_value: float | None¶
The minimum value allowed (clipped below this)
- Type:
None|float
- property max_value: float | None¶
The maximum value allowed (clipped above this)
- Type:
None|float
- property are_global_parameters_set: bool¶
Are (all) global parameters used for applying this remap function set? In this case, this is the min_value and max_value properties.
- Type:
bool
- raw_call(data: ndarray, min_value: float | None = None, max_value: float | None = None) ndarray ¶
This performs the mapping from input data to output floating point version, this is directly used by the
call()
method.- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
min_value (None|float) – A minimum threshold, or pre-calculated data minimum, for consistent global use. The order of preference is the value provided here, the class min_value property value, then calculated from the present sample.
max_value (None|float) – A maximum value threshold, or pre-calculated data maximum, for consistent global use. The order of preference is the value provided here, the class max_value property value, then calculated from the present sample.
- Return type:
numpy.ndarray
- call(data: ndarray, min_value: float | None = None, max_value: float | None = None) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable, as follows:>>> remap = Linear() >>> discrete_data = remap(data, min_value=0, max_value=100)
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
min_value (None|float) – A minimum threshold, or pre-calculated data minimum, for consistent global use. The order of preference is the value provided here, the class min_value property value, then calculated from the present sample.
max_value (None|float) – A maximum value threshold, or pre-calculated data maximum, for consistent global use. The order of preference is the value provided here, the class max_value property value, then calculated from the present sample.
- Return type:
numpy.ndarray
- calculate_global_parameters_from_reader(reader: SICDTypeReader, index: int = 0, pixel_bounds: tuple | list | ndarray = None) None ¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property max_output_value: int¶
The (read-only) maximum output value size.
- Type:
int
- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- class sarpy.visualization.remap.Logarithmic(override_name: str | None = None, bit_depth: int = 8, max_output_value: int | None = None, min_value: float | None = None, max_value: float | None = None)¶
Bases:
MonochromaticRemap
A logarithmic remap function.
- property min_value: float | None¶
The minimum value allowed (clipped below this)
- Type:
None|float
- property max_value: float | None¶
The minimum value allowed (clipped above this)
- Type:
None|float
- property are_global_parameters_set: bool¶
Are (all) global parameters used for applying this remap function set? In this case, this is the min_value and max_value properties.
- Type:
bool
- raw_call(data: ndarray, min_value: float | None = None, max_value: float | None = None) ndarray ¶
This performs the mapping from input data to output floating point version, this is directly used by the
call()
method.- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
min_value (None|float) – A minimum threshold, or pre-calculated data minimum, for consistent global use. The order of preference is the value provided here, the class min_value property value, then calculated from the present sample.
max_value (None|float) – A maximum value threshold, or pre-calculated data maximum, for consistent global use. The order of preference is the value provided here, the class max_value property value, then calculated from the present sample.
- Return type:
numpy.ndarray
- call(data: ndarray, min_value: float | None = None, max_value: float | None = None) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable, as follows:>>> remap = Logarithmic() >>> discrete_data = remap(data, min_value=1.8, max_value=1.2e6)
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
min_value (None|float) – A minimum threshold, or pre-calculated data minimum, for consistent global use. The order of preference is the value provided here, the class min_value property value, then calculated from the present sample.
max_value (None|float) – A maximum value threshold, or pre-calculated data maximum, for consistent global use. The order of preference is the value provided here, the class max_value property value, then calculated from the present sample.
- Return type:
numpy.ndarray
- calculate_global_parameters_from_reader(reader: SICDTypeReader, index: int = 0, pixel_bounds: None | tuple | list | ndarray = None) None ¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property max_output_value: int¶
The (read-only) maximum output value size.
- Type:
int
- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- class sarpy.visualization.remap.PEDF(override_name: str | None = None, bit_depth: int = 8, max_output_value: int | None = None, dmin: int | float = 30, mmult: int | float = 40, eps: float = 1e-05, data_mean: None | int | float = None)¶
Bases:
MonochromaticRemap
A monochromatic piecewise extended density format remap.
- property are_global_parameters_set: bool¶
Are (all) global parameters used for applying this remap function set? In this case, this is the data_mean property.
- Type:
bool
- raw_call(data: ndarray, data_mean: float | None = None) ndarray ¶
This performs the mapping from input data to output floating point version, this is directly used by the
call()
method.- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
data_mean (None|float) – The pre-calculated data mean, for consistent global use. The order of preference is the value provided here, the class data_mean property value, then the value calculated from the present sample.
- Return type:
numpy.ndarray
- call(data: ndarray, data_mean: float | None = None) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable, as follows:>>> remap = PEDF() >>> discrete_data = remap(data, data_mean=85.2)
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
data_mean (None|float) – The pre-calculated data mean, for consistent global use. The order of preference is the value provided here, the class data_mean property value, then the value calculated from the present sample.
- Return type:
numpy.ndarray
- calculate_global_parameters_from_reader(reader: SICDTypeReader, index: int = 0, pixel_bounds: None | tuple | list | ndarray = None) None ¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property max_output_value: int¶
The (read-only) maximum output value size.
- Type:
int
- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- class sarpy.visualization.remap.NRL(override_name: str | None = None, bit_depth: int = 8, max_output_value: int | None = None, knee: int | None = None, percentile: int | float = 99, stats: Tuple[float, float, float] | None = None)¶
Bases:
MonochromaticRemap
A monochromatic remap which is linear for percentile of the data, then transitions to logarithmic.
- property knee: float¶
The for switching from linear to logarithmic occurs in the colormap regime
- Type:
float
- property percentile: float¶
In the event that we are calculating the stats, which percentile is the cut-off for lin-log switch-over?
- Type:
float
- property stats: Tuple[float, float, float] | None¶
If populated, this is a tuple of the form (minimum, maximum, changeover).
- Type:
None|tuple
- property are_global_parameters_set: bool¶
Are (all) global parameters used for applying this remap function set? In this case, this is the stats property.
- Type:
bool
- raw_call(data: ndarray, stats: Tuple[float, float, float] | None = None) ndarray ¶
This performs the mapping from input data to output floating point version, this is directly used by the
call()
method.- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
stats (None|tuple) – The stats (minimum, maximum, chnageover), for consistent global use. The order of preference is the value provided here, the class stats property value, then calculated from the present sample.
- Return type:
numpy.ndarray
- call(data: ndarray, stats: Tuple[float, float, float] | None = None) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable as follows:>>> remap = NRL() >>> discrete_data = remap(data, stats=(2.3, 1025.0, 997.2))
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
stats (None|tuple) – The stats (minimum, maximum, chnageover), for consistent global use. The order of preference is the value provided here, the class stats property value, then calculated from the present sample.
- Return type:
numpy.ndarray
- calculate_global_parameters_from_reader(reader: SICDTypeReader, index: int = 0, pixel_bounds: None | tuple | list | ndarray = None) None ¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property max_output_value: int¶
The (read-only) maximum output value size.
- Type:
int
- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- class sarpy.visualization.remap.LUT8bit(mono_remap: MonochromaticRemap, lookup_table: str | ndarray, override_name: str | None = None, use_alpha: bool = False)¶
Bases:
RemapFunction
A remap which uses a monochromatic remap function and an 8-bit lookup table to produce a (color) image output
- property mono_remap: MonochromaticRemap¶
The monochromatic remap being used.
- Type:
- property lookup_table: ndarray¶
The 8-bit lookup table.
- Type:
numpy.ndarray
- property are_global_parameters_set: bool¶
Are (all) global parameters used for applying this remap function set?
- Type:
bool
- raw_call(data: ndarray, **kwargs) ndarray ¶
Contrary to monochromatic remaps, this is identical to
call()
.- Parameters:
data (numpy.ndarray) –
kwargs – The keyword arguments passed through to mono_remap.
- Return type:
numpy.ndarray
- call(data: ndarray, **kwargs) ndarray ¶
This performs the mapping from input data to output discrete version.
This method os directly called by the
__call__()
method, so the class instance (once constructed) is itself callable, as follows:>>> remap = RemapFunction() >>> discrete_data = remap(data, **kwargs)
- Parameters:
data (numpy.ndarray) – The (presumably) complex data to remap.
kwargs – Some keyword arguments may be allowed here
- Return type:
numpy.ndarray
- calculate_global_parameters_from_reader(reader: SICDTypeReader, index: int = 0, pixel_bounds: None | tuple | list | ndarray = None) None ¶
Calculates any useful global bounds for the specified reader, the given index, and inside the given pixel bounds.
This is expected to save ny necessary state here.
- Parameters:
reader (SICDTypeReader) –
index (int) –
pixel_bounds (None|tuple|list|numpy.ndarray) – If provided, is of the form (row min, row max, column min, column max).
- Return type:
None
- property bit_depth: int¶
The (read-only) bit depth, which should be either 8 or 16. This is expected to be enforced by the implementation directly.
- Type:
int
- property dimension: int¶
The (read-only) size of the (additional) output final dimension. The value 0 is monochromatic, where the retuned output will have identical shape as input. Any other value should have additional final dimension of this size.
- Type:
int
- property name: str¶
The (read-only) name for the remap function. This will be the override_name if one has been provided for this instance, otherwise it will be the generic _name class value.
- Type:
str
- property output_dtype: dtype¶
The output data type.
- Type:
numpy.dtype
- sarpy.visualization.remap.register_remap(remap_function: RemapFunction | Type, overwrite: bool = False) None ¶
Register a remap function for general usage.
- Parameters:
remap_function (RemapFunction|Type) –
overwrite (bool) – Should we overwrite any currently existing remap of the given name?
- Return type:
None
- sarpy.visualization.remap.get_remap_names() List[str] ¶
Gets a list of currently registered remap function names.
- Return type:
List[str]
- sarpy.visualization.remap.get_remap_list() List[Tuple[str, RemapFunction]] ¶
Gets a list of currently registered remaps.
- Returns:
List of tuples of the form (<name>, <RemapFunction instance>).
- Return type:
List[Tuple[str, RemapFunction]]
- sarpy.visualization.remap.get_registered_remap(remap_name: str, default: RemapFunction | None = None) RemapFunction ¶
Gets a remap function from it’s registered name.
- Parameters:
remap_name (str) –
default (None|RemapFunction) –
- Return type:
- Raises:
KeyError –
- sarpy.visualization.remap.density(data, data_mean=None)¶
Standard set of parameters for density remap.
- Parameters:
data (numpy.ndarray) – The data to remap.
data_mean (None|float|int) –
- Return type:
numpy.ndarray
- sarpy.visualization.remap.brighter(data, data_mean=None)¶
Brighter set of parameters for density remap.
- Parameters:
data (numpy.ndarray) –
data_mean (None|float|int) –
- Return type:
numpy.ndarray
- sarpy.visualization.remap.darker(data, data_mean=None)¶
Darker set of parameters for density remap.
- Parameters:
data (numpy.ndarray) –
data_mean (None|float|int) –
- Return type:
numpy.ndarray
- sarpy.visualization.remap.high_contrast(data, data_mean=None)¶
Increased contrast set of parameters for density remap.
- Parameters:
data (numpy.ndarray) –
data_mean (None|float|int) –
- Return type:
numpy.ndarray
- sarpy.visualization.remap.linear(data, min_value=None, max_value=None)¶
Linear remap - just the magnitude.
- Parameters:
data (numpy.ndarray) –
min_value (None|float) – The minimum allowed value for the dynamic range.
max_value (None|float) – The maximum allowed value for the dynamic range.
- Return type:
numpy.ndarray
- sarpy.visualization.remap.log(data, min_value=None, max_value=None)¶
Logarithmic remap.
- Parameters:
data (numpy.ndarray) –
min_value (None|float) – The minimum allowed value for the dynamic range.
max_value (None|float) – The maximum allowed value for the dynamic range.
- Return type:
numpy.ndarray
- sarpy.visualization.remap.pedf(data, data_mean=None)¶
Piecewise extended density format remap.
- Parameters:
data (numpy.ndarray) – The array to be remapped.
data_mean (None|float|int) –
- Return type:
numpy.ndarray
- sarpy.visualization.remap.nrl(data, stats=None)¶
A lin-log style remap.
- Parameters:
data (numpy.ndarray) – The data array to remap
stats (None|tuple) – This is calculated if not provided. Expected to be of the form (minimum, maximum, 99th percentile).
- Return type:
numpy.ndarray