`diff`: support time-series files with different resolutions
support time-series files with different resolutions: diff.py
timeseries_SET.h5 file size in y/x: (361, 387)
ion.h5 file size in y/x: (120, 193)
do diff.py timeseries_SET.h5 ion.h5 -o timeseries_SET_ion.h5 --force
timeseries_SET_ion.h5 file size in y/x: (361, 387)
Reminders
- [ ] Fix #xxxx
- [ ] Pass Pre-commit check (green)
- [ ] Pass Codacy code review (green)
- [ ] Pass Circle CI test (green)
- [ ] Make sure that your code follows our style. Use the other functions/files as a basis.
- [ ] If modifying functionality, describe changes to function behavior and arguments in a comment below the function declaration.
- [ ] If adding new functionality, add a detailed description to the documentation and/or an example.
💖 Thanks for opening this pull request! Please check out our contributing guidelines. 💖 Keep in mind that all new features should be documented. It helps to write the comments next to the code or below your functions describing all arguments, and return types before writing the code. This will help you think about your code design and usually results in better code.
@eedyyidi thank you for the PR. Could you add an example command line usage (and let me know an example data file/path for testing offline), and check the failed checks above?
PR summary
This Pull Request introduces functionality to handle time-series files with different resolutions in the diff.py script. It adds the ability to resample datasets to a common resolution before performing differencing operations. This is achieved by integrating the resize function from the skimage.transform module. The changes ensure that users can force the differencing of files with different sizes using a --force option. Additionally, the readfile.read() function is updated to include a resize2shape argument, allowing for direct resizing of datasets during reading.
Suggestion
- Documentation: It would be beneficial to update the documentation to include examples and explanations of the new
resize2shapeargument and the--forceoption indiff.py. - Error Handling: Consider adding more descriptive error messages or warnings when resizing operations might lead to significant data loss or distortion.
- Testing: Ensure comprehensive tests are added to verify the functionality of the new features, especially the resizing and differencing operations with various file sizes and resolutions.
- Performance: Evaluate the performance impact of the resizing operation on large datasets and consider optimizations if necessary.