-
Notifications
You must be signed in to change notification settings - Fork 8
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
Updated multipeak capabilities (Dev) #22
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nted code that would implement the partial fourier constraint with free-varying pixels according to a preset mask.
Conflicts: cohere_core/controller/phasing.py cohere_core/lib/cplib.py docs/source/config_mp.rst
Merging changes from source
- diff - gradient - argmin - take_along_axis - moveaxis - lstsq - zeros - indices - concatenate These methods have been implemented in cplib and nplib, but will raise NotImplementedError if called from torchlib or aflib.
Added fix for the handling og fast GA, added notes for Windows installation.
…, pad(), histogram2d(), calc_nmi(), calc_ehd(). These have only been implemented in cplib, other libraries are only implemented as stubs.
- Resampling is now included in the phasing process. - Added several new error metrics, including normalized mutual information (NMI) and expected histogram deviation (EHD) - Apply the support constraint to the full object during ER iterations (to prevent buildup of HIO feedback) - Fixed incorrect normalization when projecting to each Bragg peak. - Added a "control_peak" option to exclude one peak from the phasing process to use for unbiased error calculations. - Added a "calc_strain" option which can skip the slow strain calculation. - Added a "fast_resample" option to toggle whether the original or resampled data is used.
# Conflicts: # cohere_core/controller/phasing.py
bfrosik
added a commit
that referenced
this pull request
Apr 24, 2024
* Strain from CoupledRec (#16) * Additional documentation for multipeak phasing * Update setup.py * Update meta.yaml * Refactored get_centered to reduce number of numpy function calls. * Added a bunch of functions to cplib.py * Get strain from final reconstruction. This commit also contains commented code that would implement the partial fourier constraint with free-varying pixels according to a preset mask. * Added several new methods to the cohlib signature: - diff - gradient - argmin - take_along_axis - moveaxis - lstsq - zeros - indices - concatenate These methods have been implemented in cplib and nplib, but will raise NotImplementedError if called from torchlib or aflib. * Removed some experimental code that accidentally got included in this version. --------- Co-authored-by: Barbara Frosik <[email protected]> * fixed interface issue with cohere-ui after merge * fixed interface issue after merge * Delete reconstruction_GA_HPC.py * moved cleaning memory to lib * Delete reconstruction_HPC_GA.py * fixed problrm with parameter * fixed imoprt name * fixed docs for developers * supressed warnings in verifier when parsing device * fixed crop issue in ui * Autodata (#18) * changes for autodata option * synch with ui --------- Co-authored-by: bfrosik <[email protected]> * added debug option * moved utils from cohere-ui to cohere core and cleane up * cleaned up utils * support for auto data for separate scan ranges * aligned with cohere-ui * align with cohere-ui * relaxed verifier for auto data * relaxed verifier * aligning with ui * added missing save_dir in reconstruction scripts * added for hpc * sync with cohere-ui module * removed warning * added cluster capability * removed print statements * cleaned up, bug fixes * added description for cluster, fixed host naming issue * fixed typo * Update .readthedocs.yaml * Update .readthedocs.yaml * Update .readthedocs.yaml * Update .readthedocs.yaml * Update .readthedocs.yaml * Update README.md * Update README.md * Update README.md * fixed verifier, aligned cohere-ui * aligned with cohere-ui module * formatted text, fixed verifier for multipeak * blocked auto binning for mp and aligned ui * return correlation error in addition to aligned array * aligned ui * aligned with cohere-ui * added description in verifier, aligned with ui * Updated multipeak capabilities (Dev) (#22) * Additional documentation for multipeak phasing * Update setup.py * Update meta.yaml * Refactored get_centered to reduce number of numpy function calls. * Added a bunch of functions to cplib.py * Get strain from final reconstruction. This commit also contains commented code that would implement the partial fourier constraint with free-varying pixels according to a preset mask. * Added several new methods to the cohlib signature: - diff - gradient - argmin - take_along_axis - moveaxis - lstsq - zeros - indices - concatenate These methods have been implemented in cplib and nplib, but will raise NotImplementedError if called from torchlib or aflib. * Removed some experimental code that accidentally got included in this version. * assigned release tag * fixed doc for developers * fixed crop issue in ui * Added the following functions to cplib.py: amin(), affine_transform(), pad(), histogram2d(), calc_nmi(), calc_ehd(). These have only been implemented in cplib, other libraries are only implemented as stubs. * Significant changes that should have been committed earlier: - Resampling is now included in the phasing process. - Added several new error metrics, including normalized mutual information (NMI) and expected histogram deviation (EHD) - Apply the support constraint to the full object during ER iterations (to prevent buildup of HIO feedback) - Fixed incorrect normalization when projecting to each Bragg peak. - Added a "control_peak" option to exclude one peak from the phasing process to use for unbiased error calculations. - Added a "calc_strain" option which can skip the slow strain calculation. - Added a "fast_resample" option to toggle whether the original or resampled data is used. --------- Co-authored-by: Barbara Frosik <[email protected]> * aligned with ui * updated torch lib * fixed torchlib * removed unused function, aligned ui * synch ui * revised fftconvolve function * added comments to op flow, and simplified * modified get_ratio * removed defaults in cohere-core, added checks for misconfiguration * added error checks and prints of error messages if fail * removed code to activate lpf at last iteration * aligned with cohere-ui * added tqdm package in setup.py * added example of different sw type in features * moved checks based on type * change definition of algorithms dict to include to_direct and to_reciprocal * refactored cluster handling * changed API to receive hostfile instead of arbitrary naming it * changed api * Removed Support class and moved support array to Rec * renamed phase modulus to phase constrain * change description, slightly modified code * updated documentation * corrected docs * modified for new release * modified to do beta buid * refactored to set defaults through get, corrected decs * modified doc conf.py * modified doc conf.py * updated docs * cleaned up docs * aligning with cohere-ui --------- Co-authored-by: Nick Porter <[email protected]> Co-authored-by: Barbara Frosik <[email protected]> Co-authored-by: pfrosik <[email protected]> Co-authored-by: cxduser <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This contains all the updates I've made in the last few months. I merged all the conflicts so that it is compatible with the current state of the Dev branch. All of the changes are summarized below.
Issues fixed
shared_image
object when switching peaks after ER iterations.New features
phasing.py
rather than in the preprocessing scripts.New config_mp parameters
control_peak=[H,K,L]
determines which peak is used as the control.calc_strain=True
, if False, skip the strain calculation (saves time on repeated reconstructions where only error metrics are examined)fast_resample=True
If False, resample the reconstruction (direct space) instead of the data (reciprocal space).Devlib functions
amin()
, find the minimum of an arrayaffine_transform()
, transform an array using an affine transformation matrixpad()
, pad an array with zeroshistogram2d()
, create a 2D histogram comparing two arrays (optional log-spaced bins)calc_nmi()
, calculate the normalized mutual information between two arrayscalc_ehd()
, calculate the expected histogram deviation between two arraysChanges made for compatibility
Rec.iterate()
to the beginning ofRec.save_res()
. TheCoupledRec
class inherits theiterate()
method, and there were some compatibility issues between single-peak and multipeak centering. However, thesave_res()
method is overridden byCoupledRec
, so the conflict is ok.Known issues
fast_resample=False
) seems to cause compounding errors that prevent convergence. I have not gotten it to work, but I've left the option there for future work.raise NotImplementedError
.control_peak
feature is to remove the parameter from the configuration file. I'm sure there's a better way.