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

31: Load data from URIs #37

Merged
merged 71 commits into from
Aug 1, 2023
Merged

31: Load data from URIs #37

merged 71 commits into from
Aug 1, 2023

Conversation

krzywon
Copy link
Collaborator

@krzywon krzywon commented Apr 11, 2023

This PR adds a few non-breaking enhancements to the data loader system to aid in scripting and web-facing capabilities.

  • Fixes load data from url #31: The Loader class now recognizes URI strings, and, using the python built-in module urllib.request, opens the file at from the web address.
  • Refs Load data button should also be able to folders sasview#1845: Lists of files can now be sent to the loader instead of just a single file and all loaded Data objects will be returned as a list. Note: This functionality is not available to individual readers.
  • The loader is directly callable to allow transient instances of the loader object to aid in scripting.
  • File handles are passed to the readers instead of file names so data files (especially remote files) are only opened a single time, regardless of the number of loaders attempting to read the file, while maintaining backward compatibility when passing a file path directly to a reader.
  • Unit tests were added
    • Comparing file contents loaded from the local repository to files loaded from their GitHub URIs for the following formats: ABS, Anton-Parr SAXSess PDH, canSAS XML, NXcanSAS, 2D NIST DAT, and SESANS.
    • Comparing file contents loaded individually as compared to files loaded as a list.
    • Ensuring Readers and Loader behavior matched for individual files
  • The ReadMe was updated to match the new functionality.

krzywon added 30 commits March 27, 2023 10:15
… files loaded locally as compared to a version available by uri
Copy link

@pkienzle pkienzle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with pytest and python -m sasmodels.compare sphere -data=https://github.com/SasView/sasdata/raw/master/test/sasdataloader/data/valid_cansas_xml.xml

I still think the CustomFileOpen is unnecessarily complicated but it works as is, and it is just as much effort to change in a future PR as it is to change in this PR.

@butlerpd butlerpd merged commit 3d87774 into master Aug 1, 2023
@krzywon krzywon deleted the 31-load-data-from-url branch August 1, 2023 15:03
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.

load data from url
4 participants