Commit Graph
478 Commits
Author SHA1 Message Date
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
allevitanandClaude Sonnet 4.6 dd744a00a4 Improve plotting infrastructure and fix various bugs
- Switch panel plots to use subfigures with constrained_layout for better layout management
- Add plot_loss_history method to CDIModel base class
- Fix matplotlib compatibility for older versions (interactive backend detection)
- Make CUDA usage conditional in examples
- Add panel_plot_mode and plot_level params to FancyPtycho constructor
- Default plot_level filtering to 1 instead of 0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 15:33:49 +01:00
levita_a 44fe36d24f Kill a bunch of bugs and make the flow more sensible by hand 2026-03-20 11:09:13 +01:00
allevitan f3581b88db A first prototype from claude to test on Ra 2026-03-20 09:47:38 +01:00
allevitan 4c89b3e46b Fix the bug with loading from datasets with intensity info when OPRP is on and add test coverage 2026-03-19 22:45:57 +01:00
Dayne Yoshiki Sasaki ca3c48e83d Merge pull request #67 from cdtools-developers/new_high_NA_intensity
A small fix to the high NA propagator
2026-02-11 09:41:05 -08:00
levita_a 1dd116d277 Add the additional factor of R^2 2026-02-11 11:06:29 +01:00
Dayne Yoshiki Sasaki e56f3c959f Merge pull request #31 from cdtools-developers/near_field_ptycho
Adding near field ptychography
2026-02-10 09:52:52 -08:00
levita_a e52c6e38aa Remove the spurious 'probe_shape' parameter 2026-02-10 11:46:14 +01:00
levita_a 1d57005b33 Add the example data 2026-02-06 13:28:00 +01:00
levita_a 65e4882fdd Merge remote-tracking branch 'origin/master' into near_field_ptycho 2026-01-14 17:09:17 +01:00
levita_a a97e4cdf39 Add licensed near-field ptycho data to enable testing 2026-01-14 17:01:11 +01:00
Abe Levitan 98d2acf032 Merge pull request #66 from cdtools-developers/bugfix/surface_normal_strip
Fix a bug preventing the default surface normal of [0 0 1] from ever being defined in Bragg2DPtycho
2025-12-19 14:55:59 +01:00
yoshikisd 69a94f0fe8 Bragg2DPtycho scattering_mode string values only inspected if scattering_mode is a string 2025-12-18 18:15:19 +00:00