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

Fix downloads in notebooks #185

Merged
merged 3 commits into from
Aug 5, 2024
Merged

Fix downloads in notebooks #185

merged 3 commits into from
Aug 5, 2024

Conversation

teutoburg
Copy link
Contributor

Following AstarVienna/ScopeSim#446.

For the PSF download in MICADO, we might eventually expand the download facilities in ScopeSim, once pooch has proven to be (more) stable. For now, I used pooch's "script mode" to move AstarVienna/ScopeSim#332 forward.

@teutoburg teutoburg self-assigned this Aug 4, 2024
@teutoburg teutoburg added documentation Improvements or additions to documentation bug Something isn't working labels Aug 4, 2024
@teutoburg
Copy link
Contributor Author

teutoburg commented Aug 4, 2024

I also fixed the naming of various sim.download_packages(...) along the way. @oczoske , I only saw afterwards that you did the same for at least some notebooks in oc/issue_173, so you might want to rebase your branch once this is merged. Sorry for the complications. In fact, I think I already did the same fixes in #175, which was never quite completed...

@teutoburg teutoburg marked this pull request as ready for review August 4, 2024 19:18
Copy link
Collaborator

@hugobuddel hugobuddel left a comment

Choose a reason for hiding this comment

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

Approved, but two comments:

  • I don't think it is worthwhile to actually run the MICADO notebook and update the output. The output has not meaningfully changed, so this will add a megabyte or two to the repository for very little benefit. I think it would be better to just change the cells and commit those. Then test them, but discard those changes. (Also the MICADO notebook is broken.. MICADO notebook 3_scopesim_SCAO_4mas_fv-psf.ipynb is broken #161.)
  • These changes highlight another problem about deprecating the list argument, because now the interface is rather ugly in some cases.

@teutoburg
Copy link
Contributor Author

  • I don't think it is worthwhile to actually run the MICADO notebook and update the output. The output has not meaningfully changed, so this will add a megabyte or two to the repository for very little benefit. I think it would be better to just change the cells and commit those. Then test them, but discard those changes.

Agree. I'm not quite sure why the output would even change at all with the same random seeds. Anyway, I now force-pushed those large but useless "changes" away.

  • These changes highlight another problem about deprecating the list argument, because now the interface is rather ugly in some cases.

Disagree on that one. In all cases except the "LSS-YSO" notebook, the only resulting change was the square brackets, which in my personal opinion actually reads clearer without those, but that's more a matter of taste. Either way I think plus or minus a square bracket is negligible.

In the case of the "LSS-YSO" notebook (which I assume was the one you were referring to anyway), the change resulting from the list -> *args modification was from

sim.download_example_data(list(fitsfiles.values()))

to

sim.download_example_data(*fitsfiles.values())

Where the original list(...) was actually redundant, because the previous implementation of download_example_data checked for Iterable (as it should), which also works for dict_values. So the only "real" change is the addition of the *.

The remaining "wrap" of

fitsfiles = dict(zip(fitsfiles, sim.download_example_data(*fitsfiles.values())))

is some "iterable magic" to get the locations of the cached files back into the fitsfiles dict, which would look exactly the same when still passing a list (as the format of the output, list[Path], didn't change).

@hugobuddel
Copy link
Collaborator

Good, thank you for fixing yet another one of these!

@teutoburg teutoburg merged commit 9bd833e into dev_master Aug 5, 2024
8 checks passed
@teutoburg teutoburg deleted the fh/fixbooks branch August 5, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants