s2shores.generic_utils package

Submodules

s2shores.generic_utils.constrained_dict module

Definition of the ConstrainedDict class

authors:

see AUTHORS file

organization:

CNES, LEGOS, SHOM

copyright:

2021 CNES. All rights reserved.

license:

see LICENSE file

created:

12 oct 2024

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class s2shores.generic_utils.constrained_dict.ConstrainedDict[source]

Bases: ABC, dict

An abstract dictionary whose keys and values can be checked and possibly modified to suit specific constraints before insertion. The constraints are implemented by 2 abstract methods which takes either the key or value as argument and return the key or value to insert into the dictionary.

abstractmethod constrained_key(key: Any) Any[source]

Returns the key to use in this dictionary which satisfies some client rules.

Parameters:

key – the key to check and use to generate a constrained key

Returns:

the constrained key to use in the dictionary.

Raises:

KeyError – when the input key cannot be constrained due to its type or value.

abstractmethod constrained_value(value: Any) Any[source]

Returns the value to store in this dictionary which satisfies some client rules.

Parameters:

value – the value to check and use to generate a constrained value

Returns:

the constrained value to store in the dictionary.

Raises:

ValueError – when the input value cannot be constrained due to its type or value.

s2shores.generic_utils.directional_array module

s2shores.generic_utils.directions_quantizer module

s2shores.generic_utils.image_filters module

s2shores.generic_utils.image_utils module

s2shores.generic_utils.numpy_utils module

s2shores.generic_utils.quantized_directions_dict module

s2shores.generic_utils.signal_filters module

s2shores.generic_utils.signal_utils module

s2shores.generic_utils.symmetric_radon module

s2shores.generic_utils.tiling_utils module

Definition of several functions useful for building an image tiling

authors:

see AUTHORS file

organization:

CNES, LEGOS, SHOM

copyright:

2021 CNES. All rights reserved.

license:

see LICENSE file

created:

05/05/2021

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

s2shores.generic_utils.tiling_utils.modular_sampling(interval_min: float, interval_max: float, sampling_step: float) Tuple[int, int][source]

Given an interval of real numbers and a sampling step, select the start and stop samples inside the interval such that their values are multiple of the sampling step. Interval limits are considered as belonging to the interval.

Parameters:
  • interval_min – the lower limit of the interval (assumed to belong to the interval)

  • interval_max – the upper limit of the interval (assumed to belong to the interval)

  • sampling_step – the sampling step of the interval

Returns:

start and stop sampling indexes such that: - interval_min <= start * sampling_step <= stop * sampling_step <= interval_max

Raises:

ValueError – when interval is incorrectly specified or when no sample can be found in the interval

Module contents