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

Load range level3 Fix #162

Merged
merged 20 commits into from
Feb 1, 2024
Merged

Load range level3 Fix #162

merged 20 commits into from
Feb 1, 2024

Conversation

sanahabhimani
Copy link
Contributor

fixed the ability for load_range to read both books and .g3 files. testing on satp3 level 2 and level 3 data using config file, alias/fields, and fields arguments on the site setup.

@sanahabhimani sanahabhimani added the bug Something isn't working label Dec 27, 2023
@sanahabhimani sanahabhimani self-assigned this Dec 27, 2023
python/hk/getdata.py Outdated Show resolved Hide resolved
Copy link
Member

@mhasself mhasself left a comment

Choose a reason for hiding this comment

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

Thanks for the fix attempt here! I think there a few problems with the daq_node / node variables that mean this needs to be revised further.

I missed the earlier PR that introduced these changes, so forgive me for a few comments that go beyond the scope of the present fixes.

Please to the docstring of load_range a brief description of the two possibilities for the directory structure; either simple 5-digit folders vs. book-style naming for a specific platform.

Revise the documentation of the "daq_node"; it currently has a weird second sentence.

The "daq_node" argument will not be processed properly, if daq_node != None. It looks like daq_node and node are sharing a purpose here, and that needs to be resolved more carefully. I think you can do everything you want with just daq_node (as a function parameter that defaults to None), which gets upgraded based on the data_dir if need be.

On the variable "node" -- the code tries to guess a good value for node by looking at the data_dir. If that fails, node remains undefined, which is dangerous. Instead, you should set node = None, then search for a better value. But basically I think there's just a degeneracy with daq_node as described above.

In the folder loop, there's a test for if node in data_dir. Because of the reasons above, this will either fail (node not defined) or definitely be true (because node was set based on testing a limited set of strings against data_dir.

Have you considered simply testing, for each iteration of folder, whether any of the following patterned folders exist?:

  • {folder} (e.g. 17890)
  • {folder} (e.g. hk_17890_satp1, or whatever_17890_blarg, etc)

This would make the code less rigid -- we wouldn't have to hard-code the list of valid platforms into the function.

@sanahabhimani
Copy link
Contributor Author

the docstring could be cleaner for folder_patterns arg but ready for re-review overall.

Copy link
Member

@mhasself mhasself left a comment

Choose a reason for hiding this comment

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

Thanks. Instead of constructing a list of lists, build a single list, using extend. See comments.

python/hk/getdata.py Outdated Show resolved Hide resolved
python/hk/getdata.py Outdated Show resolved Hide resolved
python/hk/getdata.py Outdated Show resolved Hide resolved
python/hk/getdata.py Outdated Show resolved Hide resolved
python/hk/getdata.py Outdated Show resolved Hide resolved
python/hk/getdata.py Outdated Show resolved Hide resolved
Copy link
Member

@mhasself mhasself left a comment

Choose a reason for hiding this comment

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

This looks good to me.

Please get @kmharrington approval before merge, and confirm for us that you've tested this on real level 2 and level 3 structures.

Thanks!

@sanahabhimani
Copy link
Contributor Author

sanahabhimani commented Feb 1, 2024

Yes, can confirm that I have tested on level2 and level3. I used satp3 data. Mostly using config file arg, with and without folder_patterns arg using .g3 files and HK books. Also made a new directory in my home dir that had a mix of HK satp3 books and satp3 .g3 files (though didn't add HK books from other telescopes..) and tested with that.

Copy link
Member

@kmharrington kmharrington left a comment

Choose a reason for hiding this comment

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

Looking like this will work out! Thanks!

@sanahabhimani sanahabhimani merged commit 6f04188 into master Feb 1, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants