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

Add a review widget #371

Merged
merged 22 commits into from
Jul 16, 2024
Merged

Conversation

mwcraig
Copy link
Contributor

@mwcraig mwcraig commented Jun 12, 2024

This pull request adds what will be the first of the new photometry notebooks (setting camera, observatory, passband map) and the final review-of-settings notebook.

Remaining to be done:

  • add unit tests for ReviewSettings
  • add notebook for first step
  • add notebook for last step
  • add launcher entries for notebooks

Fixes #377 which was uncovered during development of this new widget.
Fixes #182 -- the notebooks were not combined but things have been streamlined a bit.

@mwcraig mwcraig marked this pull request as draft June 12, 2024 18:19
Copy link

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.44%. Comparing base (292e181) to head (4867a3b).
Report is 289 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #371      +/-   ##
==========================================
+ Coverage   77.66%   78.44%   +0.78%     
==========================================
  Files          27       27              
  Lines        3626     3758     +132     
==========================================
+ Hits         2816     2948     +132     
  Misses        810      810              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mwcraig mwcraig force-pushed the first-step-notebook branch 2 times, most recently from 78a663c to 0925b09 Compare June 13, 2024 18:22
@mwcraig mwcraig changed the title Refactor title decoration and review widget Add a review widget Jun 13, 2024
@mwcraig mwcraig force-pushed the first-step-notebook branch 3 times, most recently from b29a412 to bb66aba Compare June 20, 2024 23:20
@mwcraig
Copy link
Contributor Author

mwcraig commented Jun 28, 2024

Note: the linting failure is because ruff changed its rules -- it is not due to a code change. I'm planning to ignore it for now and open an issue to fix it later.

@mwcraig mwcraig force-pushed the first-step-notebook branch 4 times, most recently from 5ac48ec to d427bfd Compare July 1, 2024 21:51
mwcraig added 15 commits July 2, 2024 08:16
Handle StrEnum for Python 3.10

Add some explanation to ReviewSettings docstring
The test was not testing the code branch I thought because of a change in
the logic in ChooseOrMakeNew.
Rename notebooks to remove spaces
This code is necessary for now because of a bug in ipyautoui, feder-observatory#323

Refactor handling of FileChooser bug

Again! This fix is much more sensible than the last one, though, and
will require just removing a few lines of code in one place (views.py)
once the bug is fixed.
Remove debugging print
Copy link
Contributor

@JuanCab JuanCab left a comment

Choose a reason for hiding this comment

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

I have reviewed the code, only typos caught and a few clarifications sought. Will test out the notebooks later and report on that.

stellarphot/gui_tools/comparison_functions.py Show resolved Hide resolved
stellarphot/settings/custom_widgets.py Show resolved Hide resolved
stellarphot/settings/custom_widgets.py Outdated Show resolved Hide resolved
stellarphot/settings/custom_widgets.py Outdated Show resolved Hide resolved
stellarphot/settings/settings_files.py Outdated Show resolved Hide resolved
JuanCab
JuanCab previously approved these changes Jul 12, 2024
Copy link
Contributor

@JuanCab JuanCab left a comment

Choose a reason for hiding this comment

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

I have reviewed the code, only typos caught and a few clarifications sought. Will test out the notebooks later and report on that.

@JuanCab
Copy link
Contributor

JuanCab commented Jul 14, 2024

This might be better as a new issue than as something to do for this PR to get merged...

I used the review widget, I noticed that while we got an indication the whole model was bad, there was no way to find out WHY the model was bad. I purposely mis-entered the units for one entry and there was no clear indication that was the problem.

From what I understand of ipyautoui, we are suppressing the actual validation error message (which makes sense). But would it be possible to have a way of displaying the validation error if the user so chooses? Or if you want to get clever you could parse the error message and visually flag the individual bad entries, although that seems like a lot more hard work.

@JuanCab
Copy link
Contributor

JuanCab commented Jul 14, 2024

All the following tests were done in Jupyter Lab, I did test a little with VS Code and it seems consistent except some of the drop downs do NOT render properly. That might be an issue with how iPyAutoui creates its custom widgets...

Other glitches I noticed:

  • The dropdown menus don't seem to work in expected ways sometimes: Specifically:

    • Case 1: Repeated options

      1. Run all cells
      2. Select make a new camera (I used ` from drop down).
      3. Select adu for data units and 1.5 electrons / adu for gain
      4. Glitch? Read noise now presents three identical copies of 10.0 electron for noise.
      5. Glitch? Dark current now presents three identical copies of 0.01 electron / sec for noise.
      6. Glitch? I was presented with the option to select various DN, including two with the wrong, invalid units given all the previous settings. Not necessarily easily avoidable, but I could imagine it as a bit confusing for first-timers at photometry.
    • Case 2: No Option

      1. Run all cells
      2. Select to edit the Testing Camera
      3. Go to the dropdown menu for Gain... it has no options. Same with Max Data Value.
  • Another issue: AAVSO filters appear twice in dropdown

    1. I opted to edit the built in Filter wheel 1 under the Passband map tab.
    2. I clicked the red + button
    3. I added 'r' as a hypothetical filter and selected the dropdown... the R and I filters were listed twice

@Tanner728
Copy link
Contributor

Reviewing this is on my to-do list for tonight. Just FYI @mwcraig

@mwcraig
Copy link
Contributor Author

mwcraig commented Jul 15, 2024

Case 1: Repeated options ....
Glitch? Read noise now presents three identical copies of 10.0 electron for noise.

Can you double check? The last option is still 10.0 photon for me.

Glitch? Dark current now presents three identical copies of 0.01 electron / sec for noise.

Same here, I'm seeing 0.01 photon / sec as the last option.

Glitch? I was presented with the option to select various DN, including two with the wrong, invalid units given all the previous settings. Not necessarily easily avoidable, but I could imagine it as a bit confusing for first-timers at photometry.

More a design feature, though maybe it ends up being confusing. Each dropdown has three options. The set of first options are consistent with each other, the set of second options are consistent and the set of third options are consistent. However, there is no updating of the suggestions as fields are filled out. That could maybe be added iun the future...

@mwcraig
Copy link
Contributor Author

mwcraig commented Jul 15, 2024

Case 2: No Option

Run all cells
Select to edit the Testing Camera
Go to the dropdown menu for Gain... it has no options. Same with Max Data Value.

This is because by default ipyautoui makes an ipywidgets.Combobox which is a combination text box and dropdown. The dropdowns are only suggestions; any value is allowed.

In addition, the dropdowns are only shown if there is no text in the box.

You can see the same behavior in the ipywidgets documentation I linked to above.

@mwcraig
Copy link
Contributor Author

mwcraig commented Jul 15, 2024

Another issue: AAVSO filters appear twice in dropdown
...
I added 'r' as a hypothetical filter and selected the dropdown... the R and I filters were listed twice

Ah, that is because the AAVSO effectively has its own passsband map which maps R and Rc to R and similar for I, so each shows up twice.

Will open a separate issue for this.

1 similar comment
@mwcraig
Copy link
Contributor Author

mwcraig commented Jul 15, 2024

Another issue: AAVSO filters appear twice in dropdown
...
I added 'r' as a hypothetical filter and selected the dropdown... the R and I filters were listed twice

Ah, that is because the AAVSO effectively has its own passsband map which maps R and Rc to R and similar for I, so each shows up twice.

Will open a separate issue for this.

@mwcraig
Copy link
Contributor Author

mwcraig commented Jul 15, 2024

This might be better as a new issue than as something to do for this PR to get merged...

I used the review widget, I noticed that while we got an indication the whole model was bad, there was no way to find out WHY the model was bad. I purposely mis-entered the units for one entry and there was no clear indication that was the problem.

From what I understand of ipyautoui, we are suppressing the actual validation error message (which makes sense). But would it be possible to have a way of displaying the validation error if the user so chooses?

This is essentially the idea in: maxfordham/ipyautoui#308

For now, can you open an issue in this repo, @JuanCab, to add an option to display the errors, maybe by clicking on the red x?

@mwcraig mwcraig requested a review from JuanCab July 15, 2024 22:47
@JuanCab
Copy link
Contributor

JuanCab commented Jul 15, 2024

Case 1: Repeated options ....
Glitch? Read noise now presents three identical copies of 10.0 electron for noise.

Can you double check? The last option is still 10.0 photon for me.

Glitch? Dark current now presents three identical copies of 0.01 electron / sec for noise.

Same here, I'm seeing 0.01 photon / sec as the last option.

Here are screen shots showing the menus I am seeing:
Screen shot of suspect menu for Read Noise
Screen shot of suspect menu for Dark Current

@mwcraig
Copy link
Contributor Author

mwcraig commented Jul 16, 2024

Here are screen shots showing the menus I am seeing:

Ooooohhhhh, for a moment I was an old man shaking his fist in the sky in frustration that something was broken, but now I think I know what is going on.

What I said before was not quite right:

In addition, the dropdowns are only shown if there is no text in the [combo] box.

What is displayed in the combobox is only the options consistent with the text entered so far, so when 10.0 electron is already in the read noise, the combobox only shows the two entries consistent with that. If you were to erase the contents of that box you would see three choices, the last of which would be 10.0 photon.

I'm not sure what to do about this....

@Tanner728
Copy link
Contributor

I am starting to review this and just had a quick question. Do we need to provide an input box for the focal length of the system being used? I know we have our FL in the FITS header but does the "Sky" coordinate system, which I assume is WCS, need a focal length to plate solve the images?

@mwcraig
Copy link
Contributor Author

mwcraig commented Jul 16, 2024

. Do we need to provide an input box for the focal length of the system being used? I know we have our FL in the FITS header but does the "Sky" coordinate system, which I assume is WCS, need a focal length to plate solve the images?

I don't think so -- the FL can be calculated from some of the parameters that the plate solve generates. I think it could also be used as an input, but we haven't done it that way.

I gather, though, that that is something you need to provide as an input for your plate solves?

@Tanner728
Copy link
Contributor

Yeah, from my experience using Pixinsight and ASTAP (standalone platesolver) they need a focal length. It doenst need to be exact but as long as it is within putting distance of the actual FL it works.

@mwcraig
Copy link
Contributor Author

mwcraig commented Jul 16, 2024

I think we don't need that here because I've been assuming images are already plate solved....

Copy link
Contributor

@Tanner728 Tanner728 left a comment

Choose a reason for hiding this comment

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

I was not able to break these :(

JuanCab
JuanCab previously approved these changes Jul 16, 2024
Copy link
Contributor

@JuanCab JuanCab left a comment

Choose a reason for hiding this comment

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

Looks good, two typo suggestions made, but otherwise, good to go.

stellarphot/settings/tests/test_custom_widgets.py Outdated Show resolved Hide resolved
stellarphot/settings/tests/test_custom_widgets.py Outdated Show resolved Hide resolved
@mwcraig
Copy link
Contributor Author

mwcraig commented Jul 16, 2024

Looks good, two typo suggestions made, but otherwise, good to go.

Merging once tests pass 😬 🎉

@mwcraig mwcraig merged commit 2e0f41b into feder-observatory:main Jul 16, 2024
12 checks passed
@mwcraig mwcraig deleted the first-step-notebook branch July 16, 2024 19:39
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.

Cannot update already complete settings the UI Combine notebooks 01 and 02?
3 participants