527 Commits
Author SHA1 Message Date
Abe Levitan 40d53222ba Merge pull request #95 from cdtools-developers/bump_to_0.3.3.dev0
bump to next dev version
2026-08-16 09:24:15 -06:00
levita_a 790857817d bump to next dev version 2026-08-16 17:19:46 +02:00
Abe Levitan 408bdc1265 Merge pull request #94 from cdtools-developers/bump_to_0.3.2
bump version to 0.3.2
v0.3.2
2026-08-16 09:01:44 -06:00
levita_a 623da99959 bump version to 0.3.2 2026-08-16 01:11:00 +02:00
Abe Levitan f8cc9bd7d0 Merge pull request #93 from cdtools-developers/bugfix/dataset_inspect_gpu
Add test coverage for dataset.inspect on GPU and fix the relevant bug
2026-08-15 16:58:55 -06:00
levita_a d740e0484e Add test coverage for dataset.inspect on GPU and fix the relevant bug 2026-08-04 02:24:11 +02:00
sheng_p1 b3c452f16f Merge pull request #91 from cdtools-developers/alternate_lr_proposal
Alternate lr proposal
2026-07-24 14:20:03 +02:00
levita_a 289182f3f3 Update the documentation to include the example for adjusting learning rates per-parameter 2026-07-23 15:05:23 +02:00
levita_a 3252a0dd8f Update SGD to allow per-parameter learning rates and add test coverage 2026-07-23 15:00:33 +02:00
levita_a f6e0654445 Update model.Adam_optimize() 2026-07-23 14:18:24 +02:00
levita_a a6dca51e3e First working version 2026-07-23 14:11:03 +02:00
sheng_p1 d0122b1161 adjust lr 2026-07-23 11:54:14 +02:00
sheng_p1 8cf217f5d8 Add feature adjust learning rate 2026-07-23 11:50:01 +02:00
Abe Levitan 3e63ca2bcd Merge pull request #87 from cdtools-developers/fix_plotting_memory_leak
Fix a memory leak in the plotting
2026-07-23 09:36:59 +02:00
Abe Levitan f499f5460b Merge pull request #88 from cdtools-developers/move_to_rtd
Update the docs to point to readthedocs
2026-07-23 09:29:41 +02:00
Abe Levitan ebe4e79b20 Remove the custom docs build callout
I think this is no longer needed on the main page, now that all the major documentation versions should be easily available. The page with info for this remains visilble in the documentation
2026-07-23 09:11:56 +02:00
allevitan 310f78e362 Update the docs to point to readthedocs 2026-07-23 09:03:41 +02:00
levita_a d5f898a3fd Fix a memory leak in the plotting which was causing issues over long reconstructions 2026-07-22 10:56:26 +02:00
Abe Levitan 49cafdb177 Merge pull request #86 from cdtools-developers/fix_near_field_pr
Get position refinement working in near-field ptycho.
2026-07-15 13:11:59 +02:00
levita_a 211f0ac533 Apply a fix to the subpixel shifting for near-field ptycho to enable good position refinement 2026-07-11 07:14:48 +02:00
Abe Levitan a00085ba0a Merge pull request #82 from cdtools-developers/bump032dev1
bump the dev version to help referencing the latest batch of changes
2026-06-18 09:33:06 +02:00
allevitan f94ca02b20 bump the dev version to help referencing the latest batch of changes 2026-06-18 09:26:58 +02:00
Abe Levitan 6faade0ac1 Merge pull request #77 from cdtools-developers/savenload
Improve saving and loading of in-progress reconstructions
2026-06-17 15:23:30 +02:00
Abe Levitan 57a0c34229 Merge pull request #81 from cdtools-developers/fix_oversampling_pix_size
Fix an issue with the probe pixel size when probe_fourier_crop and oversampling are both used
2026-06-17 15:22:48 +02:00
allevitan 30da2ceeda Merge branch 'fix_oversampling_pix_size' into savenload 2026-06-17 00:56:48 +02:00
allevitan 5caad890b8 Fix a high priority issue with the probe pixel size when probe_fourier_crop and oversampling are both used 2026-06-17 00:56:13 +02:00
allevitan 8bb70748da Add the new save and load style to all other models except for Multislice2DPtycho, which is depricated anyway 2026-06-16 17:15:57 +02:00
allevitan 6af72e1ce0 Update the docs to include the new example for loading and viewing a ptychography reconstruction 2026-06-16 16:13:51 +02:00
allevitan 4d360f1361 Update all referencs in the examples documentation to follow the new pattern 2026-06-16 16:08:17 +02:00
allevitan dd31c39dc4 Add info on loading datasets to the tutorial 2026-06-16 16:03:40 +02:00
levita_a ed268a2c9c Update the saved gold ball ptycho treconstruction so it works with the new saving and loading 2026-06-16 15:48:14 +02:00
allevitan 4eb3a9879c Make the loading code for fancyptycho a bit more robust 2026-06-16 15:26:06 +02:00
allevitan 45949534f8 Remove the datset arg from all remaining examples of model.inspect() in the example code 2026-06-16 14:24:18 +02:00
allevitan 8ced842a58 Merge in master 2026-06-16 14:19:17 +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 83b1ed5d27 Add a script to demonstrate loading from a saved reconstruction and add the obj_view_crop and units arguments back 2026-04-13 17:35:47 +02:00
allevitan b9dcb03a93 Remove the need to use dataset for model.inspect() and model.save_results(), and update the examples accordingly. Docs and ipython notebooks not yet updated 2026-04-13 17:10:58 +02:00
allevitanandClaude Sonnet 4.6 6aa5df081b Add from_results_dict / from_results_h5 model loading from saved h5 files
Adds two classmethods to CDIModel and its ptychography subclasses that
allow models to be reconstructed from saved .h5 result files without
needing the original dataset.

- CDIModel base class: add model_class and cdtools_version to
  save_results(); add _load_results_dict() helper (restores state_dict
  + training metadata); add from_results_dict() interface method and a
  concrete from_results_h5() that reads a file and delegates to
  from_results_dict() — subclasses inherit this for free.

- SimplePtycho: make save_results(dataset=None) optional (dataset was
  accepted but never used); add from_results_dict() which reconstructs
  from probe, obj, wavelength, probe_basis, and min_translation stored
  in the state_dict.

- FancyPtycho: add optional translations parameter to __init__,
  registered as original_translations buffer; update from_dataset to
  pass translations; make corrected_translations(dataset=None) fall back
  to self.original_translations when no dataset is provided; make
  save_results(dataset=None) use stored translations when no dataset is
  provided; add from_results_dict() that detects all optional features
  (mask, translation_offsets, weights, near-field propagators, etc.)
  from the state_dict and reconstructs the full model. Also fix a latent
  bug where background was passed to t.nn.Parameter() without
  t.as_tensor(), which now fails when given a numpy array.

All existing tests pass; new tests added for both models verifying that
state_dict, training metadata, and forward pass output are all restored
exactly after a round-trip through from_results_dict and from_results_h5.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 15:47:07 +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