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

Ptychopinn devel4 #76

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

hoidn
Copy link
Collaborator

@hoidn hoidn commented Feb 27, 2024

This completes the PtychoPINN reconstructor backend. To test it, we will need a new hdf5 loader. Some GUI debugging is also required.

O H and others added 4 commits February 9, 2024 15:50
…uctor

We've made several updates to the PtychoPINNTrainableReconstructor class in the Ptychodus project to better prepare and use training data for the PtychoPINN model. These changes make the training process more straightforward and effective by improving how we load data and ensuring everything is set up correctly before training starts.

Key Updates:

- **Better Data Loading**: We now use `loader.PtychoDataContainer.from_raw_data_without_pc` to load training data more efficiently. This method simplifies loading diffraction patterns, scan coordinates, and probe guesses, making the process faster and more direct.

- **Using Ground Truth Objects**: Instead of using object patches, we've switched to using the full ground truth object for the `objectGuess` parameter. This gives the model a more accurate starting point, which can help with training.

- **Handling Probe Guesses Correctly**: We've fixed how we handle probe guesses by using the `probeArray` from the `ReconstructInput`. This ensures the model starts with a proper probe guess.

- **Checking Data Before Training**: We added checks in the `train()` method to make sure training data is loaded before we start training. This prevents errors from trying to train without data.

- **Clearer Documentation**: We've updated the comments and documentation in the `train()` method to better reflect these changes and help guide future work.

- **Making Sure Data is Loaded**: There's now a check to confirm `ingestTrainingData` has been called before training begins, ensuring all necessary data is ready.

- **Code Cleanups**: We've cleaned up the code in related areas to make it easier to read and work with, setting a good foundation for future updates.

These updates improve how the PtychoPINNTrainableReconstructor class handles training data, making the training process more reliable and easier to manage.
…I/backend integration

- **error resolution in model layer**: fixed pyright errors in `ptychopinn/model.py` by adding `setGridSize`, `setStateFilePath`, and `getStateFilePath` to `PtychoPINNModelPresenter`. This ensures model-view synchronization, aligning the presenter with `PtychoPINNModelParametersController` requirements for model state and parameter sync.

- **PtychoPINNReconstructorLibrary development**: enhanced the PtychoPINN ecosystem with the `PtychoPINNReconstructorLibrary`:
  - initialized `PtychoPINNModelSettings` and `PtychoPINNTrainingSettings` for reconstruction configuration.
  - created specific reconstructor instances for PtychoPINN algorithms.
  - introduced conditional inclusion for reconstructors based on dependencies and developer mode.
  - established an observation mechanism for settings changes, promoting adaptability.
  - adhered to the `ReconstructorLibrary` interface for consistency across reconstructor libraries.

- **GUI and backend logic integration**:
  - developed `PtychoPINNModelPresenter` and `PtychoPINNTrainingPresenter` for GUI-based settings management.
  - introduced view components for PtychoPINN settings for user interface improvements.
  - implemented controllers for UI and model layer communication, ensuring state consistency.
  - added a ViewController Factory for efficient view-controller management.
  - integrated `PtychoPINNReconstructorLibrary` into the codebase with initialization routines for model and training settings.

- **code refactoring for data ingestion**: refactored `ingestTrainingData` with a helper function for better code readability and maintainability. This improves data processing efficiency, supporting `PtychoDataContainer` generation for reconstruction tasks.

- **misc**:
  - Added PtychoPinnTrainingAutomationDatasetWorkflow equivalent to PtychoNNTrainingAutomationDatasetWorkflow for the ptychopinn backend.
  - Added a manual on implementing and using HDF5 file loaders based on the repository's file reader interfaces.
  - Added a headless start script to load HDF5 diffraction data and train the ptychopinn model backend.
  - stub out PtychoPINN workflow
@hoidn
Copy link
Collaborator Author

hoidn commented Feb 27, 2024

'ptycho' is the ptychopinn package dependency. I'll poke around to understand what you did to handle missing backends gracefully and try to repeat it with the ptychoPINN dependency

@hoidn
Copy link
Collaborator Author

hoidn commented Feb 27, 2024

Ok, with the fix to that init.py I'm able to run ptychodus without the pinn backend on my environment

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.

None yet

1 participant