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

MAINT: cleanup rendering warnings #321

Merged
merged 9 commits into from
Sep 12, 2024

Conversation

bsipocz
Copy link
Member

@bsipocz bsipocz commented Aug 27, 2024

This PR cleans up 35 warnings we currently see. There are only two untouched, one is in conflict/will be fixed in #316 while the other is related to the cloud access clean-ups and #311
(there maybe some sphinx deprecations, too, I have opened upstream PRs to fix those, we cannot do much about them here (other than adding a sphinx pin, but given we don't yet fail the CI on warnings, I don't think we gain anything by doing it)

The PR is put on top of #318 and should be rebased once that is merged in.

@bsipocz bsipocz requested a review from troyraen August 27, 2024 02:08
@bsipocz bsipocz mentioned this pull request Aug 27, 2024
6 tasks
Copy link
Contributor

@troyraen troyraen left a comment

Choose a reason for hiding this comment

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

I tried running most of these on Fornax and ran into a bunch of issues. Some are probably unrelated to this PR. Issues that do seem to be related to this PR are:

  • I have to manually select the kernel after opening the notebooks.
  • Changing code cells starting with ! to bash cells causes them to be rendered as markdown cells and prevents them from executing.

I did not try to run the spectroscopy notebooks since the changes here are only to text, not code.

Copy link
Contributor

Choose a reason for hiding this comment

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

I ran into several problems with this notebook:

  1. On Fornax I had to manually select a kernel for this notebook. I think it should be set to 'science_demo' since that's apparently the only one with tractor installed.

  2. (This looks like nway.py call is not general #313 and probably unrelated to this PR.) The cell

    # call nway
    !/home/jovyan/.local/bin/nway.py 'data/Chandra/COSMOS_chandra.fits' :ERROR_RADIUS 'data/multiband_phot.fits' 0.1 --out=data/Chandra/chandra_multiband.fits --radius 15 --prior-completeness 0.9
    
    #!/opt/conda/bin/nway.py 'data/Chandra/COSMOS_chandra.fits' :ERROR_RADIUS 'data/multiband_phot.fits' 0.1 --out=data/Chandra/chandra_multiband.fits --radius 15 --prior-completeness 0.9
    

    fails for me with /bin/bash: line 1: /home/jovyan/.local/bin/nway.py: No such file or directory. Using the commented-out line that points to /opt/conda/... instead of /home/jovyan/... works.

  3. The first figure in section '5. Plot Final Results' is empty and the second one throws an AttributeError. I don't know whether it's related to this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

the nway cell is being fixed by #316; I just have one minor question there for which I would like to see other opinions. (my preference would be to do the PATH change up at the very top where we also add code_src, but if I'm alone with this preference, then it can go in as-is)

name: conda-root-py
name: python3
Copy link
Contributor

Choose a reason for hiding this comment

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

With this change, I have to manually select the kernel. Changing this back to name: conda-root-py works out of the box.

Copy link
Member Author

Choose a reason for hiding this comment

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

those custom kernel names doesn't work for the CI. I would recommend opening a separate bug report issue for it, though #303 may cover it.

Comment on lines 100 to 109
```{code-cell} ipython3
```bash
# To download the data file containing the light curves from Googledrive
!gdown 1gb2vWn0V2unstElGTTrHIIWIftHbXJvz -O ./data/df_lc_020724.parquet.gzip
$ gdown 1gb2vWn0V2unstElGTTrHIIWIftHbXJvz -O ./data/df_lc_020724.parquet.gzip
```
Copy link
Contributor

Choose a reason for hiding this comment

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

With this change, the bash code becomes part of the markdown cell above and is not executable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Starting with a clean environment, I had to make a few additions to this file.

# beginning of the notebook, make sure the lists are consistent and only
# contain dependencies that are actually used in the notebook.
tqdm
numpy
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
numpy
numpy<2.0 # sompy requires numpy<2.0

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeap, it's done here in fada9e7

numpy
scipy
pandas
matplotlib
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
matplotlib
matplotlib
scikit-image # sompy requires scikit-image

Copy link
Member Author

Choose a reason for hiding this comment

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

I missed this one, thanks! will rather add it to fada9e7

Comment on lines 172 to 175
```{code-cell}
!cat output/lightcurves-demo-SDSS-500k/logs/scale_up.sh.log
```bash
$ cat output/lightcurves-demo-SDSS-500k/logs/scale_up.sh.log
Copy link
Contributor

Choose a reason for hiding this comment

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

With this change, the bash code becomes part of the markdown cell above and is not executable. Same for the four other changes in this file.

# List explicit python dependencies here. They are also spelt out at the
# beginning of the notebook, make sure the lists are consistent and only
# contain dependencies that are actually used in the notebook.
numpy
Copy link
Contributor

Choose a reason for hiding this comment

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

In the science_demo environment, I had to also install numba.

Suggested change
numpy
numba # required by Arsenal (sktime)
numpy

Copy link
Member Author

Choose a reason for hiding this comment

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

It gets pulled without issues both locally and in CI, so I would rather not list it as we don't use numba directly.
(see the log in #309)

Copy link
Contributor

Choose a reason for hiding this comment

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

tqdm doesn't seem to be working anymore. The iterator doesn't progress and the time stays at "00:00<?". My guess is that it's from #300. Here's an example screenshot:

Screenshot 2024-08-27 at 3 54 13 PM

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, interesting. Do you have this issue in the other notebooks, too? Do you have ipywidgets installed?

Copy link
Member Author

Choose a reason for hiding this comment

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

(as it's already in main, could you open a bug report issue for it?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have this issue in the other notebooks, too?

Yes, in ML_AGNzoo at least.

Do you have ipywidgets installed?

Yes, ipywidgets==8.1.5

Copy link
Contributor

Choose a reason for hiding this comment

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

Opened #323

Copy link
Contributor

Choose a reason for hiding this comment

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

I've had this notebook running for about an hour and it's still not done. It has been stuck on the second cell in section '4) Repeating the above, this time with ZTF + WISE manifold' for most of the time. It hasn't crashed (top shows that the CPU is still in use), though there are a bunch of warnings. I don't know whether this is normal/expected or not.

Copy link
Member Author

@bsipocz bsipocz Aug 27, 2024

Choose a reason for hiding this comment

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

I can't comment on that as I got stuck with the data download both locally and in CI, maybe open a separate issue for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I can confirm that I also timeout on that cell locally.

Copy link
Contributor

Choose a reason for hiding this comment

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

Opened #324

name: conda-env-science_demo-py
name: python3
Copy link
Contributor

Choose a reason for hiding this comment

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

With this change, I have to manually select the kernel. Changing this back to name: conda-env-science_demo-py works out of the box.

@bsipocz
Copy link
Member Author

bsipocz commented Aug 28, 2024

OK, so I'll revert the last commit (7904008) that changed the ! bash command cells to a shell cell as while the change fixes the warnings it's also breaks those cells (e.g. #322)

@bsipocz
Copy link
Member Author

bsipocz commented Aug 28, 2024

OK, so given some of the issues we run into here, I would reorganise the commits in this and #309, and bring the commits into this that are uncontroversial (additional dependency installs, etc.) at the expense of knowingly not fixing all the warnings.

And all the rest that are needed for execution but causing some inconveniences (e.g. kernel names) will be gathered in the actual CI PR.

@bsipocz
Copy link
Member Author

bsipocz commented Sep 12, 2024

OK, so I cleaned up this PR and only included the commits (and new fixes) that didn't cause any issues above. The rest will go into #309

@bsipocz bsipocz merged commit 6d66e51 into nasa-fornax:main Sep 12, 2024
3 checks passed
@bsipocz bsipocz deleted the MAINT_warning_cleanups branch September 12, 2024 21:19
github-actions bot pushed a commit that referenced this pull request Sep 12, 2024
github-actions bot pushed a commit to bsipocz/fornax-demo-notebooks that referenced this pull request Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants