Skip to content

Conversation

@tylerflex
Copy link
Collaborator

Currently, the SimulationData object loads the raw field, flux, and mode data.
This PR provides a way to normalize frequency-dependent data by the spectrum of one of the original sources.
This eliminates the need to run a separate normalization simulation in some cases.

Main changes to the API:

  • FreqData (frequency-dependent monitor data) has a .normalize(source_amps) abstract method, that changes their .values in place given some source amplitude spectrum.
  • ScalarFieldData, FluxData, and ModeData implement .normalize(source_amps) methods for their respective data types (depending on whether they are field-like or power-like data).
  • sim_data_normalized = SimulationData.normalize(normalize_index) normalizes all of the FreqData in the SimulationData using the respective .normalize() functions defined above. normalize_index indexes into the Simulation.sources list to grab the source time-dependence to normalize by. A copy is created, as to preserve the original data in case one wants to normalize by a different source later.
  • web.load() adds a normalize_index argument to allow users to normalize upon loading the data into SimulationData objects.
  • This normalize_index is propagated to all places in web API and web container that call web.load().

Tests show Flux==1 to 1e-4 tolerance for plane wave.

Copy link
Collaborator

@momchil-flex momchil-flex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and passes both my PlaneWave and GaussianBeam unit flux tests. Fine by me to merge.

@tylerflex tylerflex merged commit 7b174b1 into develop Jan 14, 2022
@tylerflex tylerflex deleted the source_norm branch January 14, 2022 00:46
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.

2 participants