Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live visualization #35

Merged
merged 10 commits into from
Nov 4, 2024
Merged

Live visualization #35

merged 10 commits into from
Nov 4, 2024

Conversation

jacione
Copy link
Contributor

@jacione jacione commented Oct 24, 2024

Potential solution to issue #10.
 
I added live_operation() to Rec and CoupledRec, which allows the reconstruction progress to be viewed in real time. For single-peak BCDI, it shows the amplitude, phase, and support, along with a plot of the error. For multipeak, the error/support panels are replaced by the diffraction pattern currently in rotation, before and after alien removal. The diffraction patterns are not central slices but are instead summed along one axis (this allows aliens to show up despite not being centered).

The corresponding live_trigger goes in config_rec and follows standard trigger notation. The documentation has been updated to include this. The trigger is activated immediately after progress_trigger.

P.S. I don't know why this also included all of the commit history from my last PR (#32).

jacione added 10 commits October 1, 2024 15:48
Before phasing on a new peak, it compares the shared-object projected diffraction to the actual measured diffraction (both with a 1-pixel gaussian blur). A difference map is defined as the absolute difference between the two blurred images divided by the blurred projection. A mask is generated from all the voxels where the difference map is greater than twice its own median.
While the peak is being phased, the Fourier constraint is enforced using the measurement outside the mask and the projection inside.
…aint. The amount of feedback depends on that peak's confidence value.
Removed:
- adaptive_weights (replaced by adapt_trigger)

Added:
- adapt_trigger: Puts the adaptive weighting in the operation/trigger format
- adapt_power: Basically how harshly bad peaks are punished
- adapt_alien_start: When to start removing aliens
- adapt_alien_threshold: Voxels are masked where the error map exceeds this times its median

Renamed:
- weight_X << mp_weight_X
- adapt_threshold_X << peak_threshold_X
# Conflicts:
#	cohere_core/controller/phasing.py
@brussel13
Copy link
Contributor

brussel13 commented Oct 24, 2024 via email

@bfrosik
Copy link
Contributor

bfrosik commented Nov 4, 2024

Is the code in lines 174-275 necessary? Seems that the line 148 would do.

@jacione
Copy link
Contributor Author

jacione commented Nov 4, 2024

I think you're referring just to lines 274-275?

In line 148, plt.show() gets called with the argument block=False, which allows the main process to continue, but it also closes out the figure as soon as the reconstruction finishes. The call in line 275 blocks the process so that the final frame stays up until you close the figure manually.

@bfrosik
Copy link
Contributor

bfrosik commented Nov 4, 2024

Thanks, good explanation.

@bfrosik bfrosik merged commit 0fe08f7 into AdvancedPhotonSource:Dev Nov 4, 2024
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