Commit Graph
491 Commits
Author SHA1 Message Date
levita_a b6c96557a0 Fix the object display and also update the interactions so that multi-mode objects work as intended 2026-04-28 14:36:46 +02:00
Abe Levitan 29f0036248 Merge pull request #79 from cdtools-developers/bugfix/saving_loss_metrics
Fix a high priority bug where reconstructions will crash upon saving
2026-04-20 16:06:44 +02:00
levita_a a516f418b9 Fix a high priority bug where reconstructions will crash upon saving, and add test coverage to prevent a repeat 2026-04-20 15:40:55 +02:00
Abe Levitan 65a75b5c7e Merge pull request #70 from cdtools-developers/newpoisson
Switch to a more sensible normalization strategy for loss metrics
2026-04-17 15:12:03 +02:00
levita_a fcd0b31b2c Fix a bug with the mask implementation for the normalizers conflicting with SimplePtycho, and update the thresholds to accomodate the new normalization with masks and for intensity_MSE 2026-04-13 15:44:52 +02:00
allevitan d8fade9f32 Update the amplitude MSE and intensity MSE loss to act equivalently - currently, the intensity MSE loss was by default a mean, but amplitude was by default a sum. Both functions now have a flag, use_sum=False, which is False by default. This changes the default behavior of amplitude_mse. All models, including the tutorial version of simple_ptycho, are updated accordingly and test coverage was added. 2026-04-13 14:34:23 +02:00
levita_a 3c15b19ba7 Find and fix a bug where the normalization code didn't properly include masks 2026-04-10 16:22:58 +02:00
levita_a 3d10f36739 Fix a bug where the normalizers stopped the loss history from being saved as a numpy scalar, and added test coverage 2026-04-05 22:23:23 +02:00
levita_a 388d1669f3 Final checks to ensure all tests pass with the new scaling 2026-04-05 21:52:14 +02:00
levita_a 8ee8bf9237 Fix bug where fancyptycho test was not being run on GPU 2026-04-03 18:59:09 +02:00
levita_a b6553fd522 Update the example near field ptycho code to use Poisson NLL 2026-04-03 18:48:35 +02:00
allevitanandClaude Sonnet 4.6 3ccdc24d3f Restructure loss coverage in reconstruction tests
- Revert test_Adam_gold_balls to default amplitude_mse
- Add new test_intensity_MSE test (gold balls + AdamReconstructor)
- Update near_field threshold to 17 (poisson_nll scale)
Thresholds for test_intensity_MSE to be tuned after GPU run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 18:46:27 +02:00
allevitanandClaude Sonnet 4.6 178e9a4e4e Add loss function coverage to slow reconstruction tests
Use poisson_nll in test_near_field_ptycho and intensity_mse in
test_Adam_gold_balls to exercise these loss paths end-to-end.
Thresholds left as-is pending re-running on a GPU machine.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 18:45:29 +02:00
allevitanandClaude Sonnet 4.6 d644782e94 Update poisson_nll test to match sum-based implementation
poisson_nll now returns a sum rather than a mean, consistent with the
normalizer pattern. Remove the per-pixel divisions from the numpy
reference calculations accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 18:44:04 +02:00
allevitanandClaude Sonnet 4.6 fd17ae30ba Update tutorial to use loss instance attribute pattern
Updates tutorial_simple_ptycho.py to match simple_ptycho.py: removes
the def loss() method and instead assigns self.loss and
self.loss_normalizer as instance attributes in __init__.

Updates tutorial.rst accordingly: adds the loss assignment to the
__init__ code block with an explanation, and removes def loss() from
the forward model section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 18:44:04 +02:00
allevitanandClaude Sonnet 4.6 8c380a34a6 Add intensity_mse loss option to all models
Adds 'intensity_mse' as a selectable loss function (alongside the
existing 'amplitude_mse' and 'poisson_nll') to FancyPtycho,
MultislicePtycho, Bragg2DPtycho, Multislice2DPtycho, and RPI.
Models that previously had a hardcoded amplitude_mse assignment now
use the same configurable pattern as FancyPtycho, with the loss
parameter threaded through from_dataset and from_calibration as well.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 18:43:56 +02:00
levita_a d2c09acd44 Get all tests passing by updating the loss thresholds for the new normalizations, and add the new normalization to all models 2026-04-03 18:38:11 +02:00
allevitan 023ab318ee Added some better documentation to the loss functions 2026-04-03 18:38:11 +02:00
allevitan 4dbcffd67b Attempted to update the normalizations for the loss functions in a way which allows for a nice normalization of the Poisson NLL. The slow tests will now likely fail 2026-04-03 18:38:11 +02:00
Abe Levitan 3f028e2fbf Merge pull request #72 from cdtools-developers/feature/betterplots
A bunch of long overdue updates to the plotting system
2026-04-03 18:23:41 +02:00
Abe Levitan 06105d38c7 Merge pull request #76 from cdtools-developers/v0.3.2.dev
Start on 0.3.2.dev
2026-04-03 18:22:19 +02:00
levita_a 3b6e73b48c Start on 0.3.2.dev 2026-04-03 18:20:53 +02:00
allevitan a87e3415d2 Responding to self-review comments 2026-04-03 17:54:59 +02:00
Abe Levitan 40f829b430 Merge pull request #71 from cdtools-developers/bugfix/intensity_loading
Fix issue #68 for loading of datasets with intensities when using OPRP
2026-04-03 16:24:16 +02:00
Abe Levitan d7d5ed8401 Merge pull request #73 from cdtools-developers/v0.3.1
Change version to 0.3.1
v0.3.1
2026-04-03 15:43:45 +02:00
Abe Levitan 48a9a7f8ac Merge pull request #75 from cdtools-developers/readthedocs
Update the docs so it doesn't always think it's v0.2.0
2026-04-03 15:29:16 +02:00
allevitan 05bdee3861 Update the docs so it doesn't always think it's v0.2.0 2026-04-03 15:24:50 +02:00
Abe Levitan e84dc9f76e Merge pull request #74 from cdtools-developers/readthedocs
Add .readthedocs.yaml for ReadTheDocs hosting
2026-04-03 14:32:24 +02:00
allevitanandClaude Sonnet 4.6 7de8448319 Add .readthedocs.yaml for ReadTheDocs hosting
Enables versioned documentation on ReadTheDocs. Installs the package
with its docs extras (sphinx, sphinx-rtd-theme, sphinx-argparse) so
autodoc can import cdtools during the build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 14:28:01 +02:00
allevitan 4030218fa4 Change version to 0.3.1 2026-03-26 15:11:55 +01:00
allevitan 0bd8df498c Updated the documentation to reflect the changes to the plotting system 2026-03-24 21:39:04 +01:00
allevitan 4172a9a11a A few small changes to revert unimportant edits and fix linting issues 2026-03-24 19:34:38 +01:00
levita_a f55b35f0dd Stop stopping at each plot to show it 2026-03-24 16:56:44 +01:00
allevitan 603486e824 Change the default colormap for exponentiated objects to match that for un-exponentiated objects, and also update test_fancy_ptycho to show all the plots (not just plot level 2) 2026-03-24 16:55:56 +01:00
allevitan ad2b09f2f0 Update the tests to work better when checking the model plotting, and make sure to cover panel_plot_mode=False 2026-03-24 16:19:26 +01:00
allevitanandClaude Sonnet 4.6 29e9fddd72 Add test coverage for plot_translations, plot_nanomap, and plot_nanomap_with_images
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 16:01:45 +01:00
allevitan 25c7b66c7c Do a final review of all the examples to ensure they work and are well structured 2026-03-24 11:10:23 +01:00
allevitanandClaude Sonnet 4.6 5c5c0be7c6 Reformat plotting function signatures to one-parameter-per-line style
All public functions in plotting.py now use the expanded multi-line
signature format with trailing commas for consistency and readability.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 11:00:43 +01:00
levita_a 4201b41573 Made more adjustments to the plotting system to avoid using constained_layout, which was causing hangups during live plotting and didn't look as nice 2026-03-24 09:13:51 +01:00
levita_a f979388280 Fix an annoying warning coming from double-setting the figsize 2026-03-21 21:42:16 +01:00
allevitan 29656fd78e Improve the colorized plotting further, and add a colorbar which will be useful for publishing figures now that it's not just a simple hsv lookup. Also fix a bug with nonresponsive windows when all model plots are closed, but the dataset plots are still showing. 2026-03-21 21:27:16 +01:00
allevitan f04ac9f0ec Make the colorized plot look nicer, with a more perceptually uniform mapping and a colorbar for accurate reading of phases 2026-03-21 17:35:14 +01:00
allevitan a4a38530d1 Update the plot_image functions to show sliders 2026-03-21 14:57:16 +01:00
allevitan f8ff525722 Add example patterns for jupyter notebooks 2026-03-21 08:41:18 +01:00
levita_a dafb204aa0 Fix a bug where closed windows wouldn't reopen at the original size 2026-03-20 20:18:32 +01:00
allevitan bef907c032 Added a minimum plotting interval to model.inspect(dataset) to make it easier to not plot so much without manual intervention 2026-03-20 20:01:40 +01:00
levita_a f35141dcc8 Check that all the models work (all but Multislice2DPtycho, which was already broken, and make necessary tweaks 2026-03-20 19:39:47 +01:00
allevitan 91db5b3c64 Update remaining models to new plot registration system 2026-03-20 19:01:22 +01:00
allevitan e7f943e254 Made a few more updates to some example scripts, to show the panel plot mode 2026-03-20 17:35:25 +01:00
allevitanandClaude Sonnet 4.6 f4260837bc Add title option to plot_image and wrappers; misc fixes
- Add title parameter to plot_image, plot_real, plot_imag, plot_amplitude,
  plot_phase, and plot_colorized
- Various fixes to base.py and fancy_ptycho.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 17:20:52 +01:00