-
Notifications
You must be signed in to change notification settings - Fork 8
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
Made notebooks run with current hera_sim #238
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #238 +/- ##
=======================================
Coverage 93.34% 93.34%
=======================================
Files 25 25
Lines 3428 3428
Branches 737 737
=======================================
Hits 3200 3200
Misses 122 122
Partials 106 106
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Thanks @hughbg. I can't seem to make comments directly on the notebooks in reviewnb for some reason, so I will just leave comments here: hera_sim_defaults
hera_sim_simulator
hera_sim_tour
polybeam_simulation
visibility_simulator
|
Thanks for the updates @hughbg. I'm a little confused about some of the things that I'm seeing. According to some of the output from the I'm just going to add some comments in response to the things @steven-murray raised in his review, as well as maybe a few of my own (or some suggestions), with the hope that the input is useful. hera_sim_defaults
hera_sim_simulator
hera_sim_tour
As for the other notebooks, I don't have any comments beyond what @steven-murray has pointed out. Thanks again for your work @hughbg! Hopefully it'll only be a few iterations for us to get everything wrangled. |
I've uploaded a new version of hera_sim_defaults. Rerunning the cells in order fixed some issues. I switched the beam and bandpass code to
The old code was returning model values whereas this code is returning values interpolated from the models. That is in accord with the y-label axes which have always referred to beam and bandpass values (area and gains) rather than models. The plots are quite different now. |
@r-pascua and @hughbg, I have finally gotten back to this PR. I did the following:
|
@@ -26,7 +26,7 @@ | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change vis_cpu
to matvis
, add fftvis
to the list of supported simulators, and maybe note that healvis
is deprecated (or just remove it from the list)?
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Changed to matvis
,added fftvis
and removed healvis
.
@@ -26,7 +26,7 @@ | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line #1. vis_cpu_sim = VisibilitySimulation(data_model=data_model, simulator=MatVis())
Should we change this (and following occurrences) to matvis_sim
?
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. Done.
@@ -26,7 +26,7 @@ | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops! Good catch.
@@ -26,7 +26,7 @@ | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we think it's worthwhile for me to edit the figure caption with a better description of how to interpret the simulation data?
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that would be great!
@@ -18,36 +18,15 @@ | |||
"cell_type": "code", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While not necessary, I would like to update this to make better plots in the future.
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted.
@@ -18,36 +18,15 @@ | |||
"cell_type": "code", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something got messed up here. Instead of plotting np.polyval(...)
,we should just be plotting bps[seas]
and beams[seas]
,since they were evaluated a few cells up via h1c_beam = hera_sim.defaults("omega_p")(fqs)
and so on. hera_sim.defaults.("omega_p")
will return an instance of a subclass of hera_sim.interpolators.FreqInterpolator
which may then be called to interpolate to the desired frequencies.
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally! OK fixed that.
@@ -18,36 +18,15 @@ | |||
"cell_type": "code", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line #6. sim1.run_sim(**sim1params)
This should be moved between line 3 and line 4. I'm pretty sure the main reason the two plots look different is that the random seed is different.
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Fixed.
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:23Z Line #7. ax1.set_xlabel(None) I think a better way to do this is to replace this line and line 8 with |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:23Z Is the change to steven-murray commented on 2024-09-09T12:54:56Z no, it's a numpy 2 thing. |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:24Z I'm guessing steven-murray commented on 2024-09-09T12:55:12Z Also a numpy 2 thing. |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:25Z Something has broken. I'm suspecting that it has to do with the change to steven-murray commented on 2024-09-09T13:08:28Z OK, I tried some stuff out and it turns out that the differences are due to the original simulation having some negative real parts of the autos. When this is saved to file and re-read, the imaginary parts are forced to zero, and the real parts are made positive. Not sure what to do about that. r-pascua commented on 2024-09-09T21:32:29Z OK, my fix was pretty coarse: I just made it so that autocorrelations are modified via steven-murray commented on 2024-09-10T10:29:34Z That sounds fine to me |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:25Z Something has broken here--the first value should be r-pascua commented on 2024-09-09T21:33:19Z Fixed this issue. The |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:26Z Line #5. np.any(vis_A[blt_inds]), # The first application give (0, 1) noise, Looks like I forgot to add "didn't" to the comment. |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:27Z Line #18. Smin=0.5, Might be a good idea to bump this up quite a bit, since it leads to a bit of cognitive dissonance in the following plot (not all parts of the "bright sources" plot are higher amplitude than any part of the "faint sources" plot---this is fine, but the reason why it's fine is perhaps a bit nuanced). steven-murray commented on 2024-09-09T13:11:46Z I set it to 5-20 instead of 0.5-10. I think it looks pretty reasonable now. |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:27Z Ah. I think in order to fix this bug we need to add steven-murray commented on 2024-09-09T13:17:26Z Good - fixed. |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:28Z It looks like mutual coupling isn't showing up in the list for some reason? steven-murray commented on 2024-09-09T13:19:10Z Huh. Just ran it again and it's there r-pascua commented on 2024-09-09T17:45:40Z weird |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:29Z Line #1. print("\n".join(str(f) for f in tempdir.iterdir())) Maybe change this to steven-murray commented on 2024-09-09T13:20:19Z DOne.
|
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:29Z Line #1. print("\n".join(str(f) for f in tempdir.iterdir() if str(f).endswith("files.uvh5"))) Same as previous comment steven-murray commented on 2024-09-09T13:20:23Z Done |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:30Z Maybe change the reflections to a bandpass, or make the reflection amplitude lower, since the 1%-level reflections are making the figure below look kind of insane. steven-murray commented on 2024-09-09T13:21:43Z I set it to amp=1e-4 r-pascua commented on 2024-09-09T21:36:51Z Huh, looks like that didn't help much. Probably some annoying thing with a small set of observing times leading to the mock EoR component dominating the signal? Looks like this has been an issue for a while, so I suppose I'm fine with leaving it as-is. steven-murray commented on 2024-09-10T10:30:17Z Yeah, something to dig into later if we need to. |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:31Z Line #2. import aipy We're not using steven-murray commented on 2024-09-09T13:24:44Z Not in general. I've swapped this out to use |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:32Z Line #1. uvtools.plot.labeled_waterfall(nos_jy, mode="log", freqs=fqs*1e9, lsts=lsts) Can we restrict the dynamic range on this plot? Right now we have too much dynamic range, so it's very hard to see that there are noise fluctuations (it just looks kind of grainy). I think it's as simple as setting steven-murray commented on 2024-09-09T13:27:15Z Done. |
View / edit / reply to this conversation on ReviewNB r-pascua commented on 2024-08-27T22:44:33Z Looks like we lost the impulse and scatter RFI? I'm guessing that it's there, but the amplitude is too low. steven-murray commented on 2024-09-09T14:32:35Z I can see it if I take the other RFI components away, so it is there. Their magnitude is so different that they don't show well in this plot. Plotting on log scale doesn't work either because most of the array is zero so it just bombs out.
r-pascua commented on 2024-09-09T21:39:01Z Gotcha. Thanks for checking! |
Also a numpy 2 thing. View entire conversation on ReviewNB |
OK, I tried some stuff out and it turns out that the differences are due to the original simulation having some negative real parts of the autos. When this is saved to file and re-read, the imaginary parts are forced to zero, and the real parts are made positive. Not sure what to do about that. View entire conversation on ReviewNB |
I set it to 5-20 instead of 0.5-10. I think it looks pretty reasonable now. View entire conversation on ReviewNB |
Good - fixed. View entire conversation on ReviewNB |
Huh. Just ran it again and it's there View entire conversation on ReviewNB |
DOne.
View entire conversation on ReviewNB |
Done View entire conversation on ReviewNB |
I set it to amp=1e-4 View entire conversation on ReviewNB |
Not in general. I've swapped this out to use View entire conversation on ReviewNB |
Done. View entire conversation on ReviewNB |
I can see it if I take the other RFI components away, so it is there. Their magnitude is so different that they don't show well in this plot. Plotting on log scale doesn't work either because most of the array is zero so it just bombs out.
View entire conversation on ReviewNB |
Yup, good. View entire conversation on ReviewNB |
Done View entire conversation on ReviewNB |
Done View entire conversation on ReviewNB |
weird View entire conversation on ReviewNB |
Prior to this commit, any vis_filter keys provided when simulating an effect were not saved in the Simulator._components dictionary, so retrieving effects that were only applied to a subset of the array via Simulator.get would give incorrect results.
OK, my fix was pretty coarse: I just made it so that autocorrelations are modified via View entire conversation on ReviewNB |
Fixed this issue. The View entire conversation on ReviewNB |
Huh, looks like that didn't help much. Probably some annoying thing with a small set of observing times leading to the mock EoR component dominating the signal? Looks like this has been an issue for a while, so I suppose I'm fine with leaving it as-is. View entire conversation on ReviewNB |
Gotcha. Thanks for checking! View entire conversation on ReviewNB |
OK, I think I've fixed the last of the issues and removed debug things from the notebooks. @steven-murray please take one last look to ensure we didn't miss anything before merging! |
That sounds fine to me View entire conversation on ReviewNB |
Yeah, something to dig into later if we need to. View entire conversation on ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looks good now.
Updated notebooks. They run, but may not make use of all the new features properly, so that needs to be examined.