Skip to content

Conversation

@yurirtonin
Copy link
Collaborator

The clipping input is now assumed to be either a 2-tuple or 4-tuple.

In case it is as 2-tuple, it is assumed to be (mininum_magnitude, maximum_magnitude)
In case it is as 4-tuple, it is assumed to be (mininum_magnitude, maximum_magnitude, minimum_phase,maximum_phase)

For ignoring a specific clipping, use None. For instance: (minimum_magnitude, None, None, maximum_phase)

I kept the approach that was already implemented for the magnitude clipping, so it is done right after object update and before probe update.

Done:

  • Change clipping functions to clip not only magnitude but also phase (CPU and cupy)
  • Renamed .cu file and functions that referred to "clip magnitude" to "clip object"
  • Add clipping functionality to stochastic engine (CPU and cupy)
  • Add clipping functionality to ML engine (CPU and cupy)
  • Edit WASP engines to also use the new clipping strategy

Still possible ToDos:

  • add clipping strategy to pycuda engines
  • Improve clipping strategy (see comment below)

One open point of discussion: what is the "correct" way of doing such a clipping? Currently, we clip the magnitudes (np.abs) followed by clipping of the phase (np.angle), which would result in a behavior in the complex plane as the following:

Image

Yuri R. Tonin added 6 commits September 15, 2025 09:42
- Changed clipping for both magnitude and phase, not only magnitude
- Added clipping functionality to stochastic engines (CPU and cupy)
- Renamed .cu file to clip_object
- Renamed functions that referred to magnitude clipping
- Added soft clipping to ML algorithm (CPU and cupy)
- Added it to stochastic and projectional serial engines
- Small cleanups
@yurirtonin yurirtonin closed this Sep 26, 2025
@yurirtonin yurirtonin reopened this Sep 26, 2025
@yurirtonin
Copy link
Collaborator Author

yurirtonin commented Sep 26, 2025

Fixed a couple of refactoring I had missed. Nonetheless, the latest test error on WASP_serial regarding the complex type of the object I am not sure how to solve yet. Running the WASP and WASP_cupu engines directly do not present this error

…ion to use the obj container instead of npy array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants