-
Notifications
You must be signed in to change notification settings - Fork 0
Add wiregrid.time_constant
function
#179
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
Conversation
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.
I comment in terms of hwp controls for this type of measurements that spins up and down hwp.
-
I suggest streaming separately for forward spin and backward spin. This is because hwp solution pipeline assumes constant rotation direction within the data range. It requires more work to analyze it if both forward and reverse spin are included in the data range.
-
For the hwp rotation direction estimation, you can just use.
apply_hwp_angle_model(tod, on_sign_ambiguous='offcenter')
. It might be possible to simplify functions. The hwp rotation direction estimation has to be different from cmb observations bacausehwp_solution.pid_direction
is not reliable for spin down measurement. This is because commanded spin direction and actual spin direction is different when hwp is spinning down.hwp_solution.offcenter_direction
will be the robust rotation direction estimator for this hwp spin down up measurements.
Thanks Kyohei!
|
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.
I add comments around insert() and eject().
I'm concerned about future automation of gl calibration. I will let you decide, but I don't see any disadvantage of splitting stream. If you split, you don't need to re-calculate hwp solution. |
53df2c2
to
f1e1157
Compare
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #179 +/- ##
=======================================
Coverage ? 84.15%
=======================================
Files ? 10
Lines ? 631
Branches ? 0
=======================================
Hits ? 531
Misses ? 100
Partials ? 0 ☔ View full report in Codecov by Sentry. |
Thanks, Kyohei and Daiki. |
OK, I'm fine if you don't mind recalculating the hwp angle. |
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.
Here's a first pass at a review from me. A couple general comments/comments:
- Please wrap lines to ~80 characters. I'm not super strict on the exact length, but there are some pretty long lines (100+) characters here. Try to be consistent with the existing code here.
- How often will this be run? Daily? Monthly? Once? I was a bit surprised to see the PR, thinking we had implemented the regular calibration in
wiregrid.calibrate()
already. - We need tests. I've been pretty meticulous to keep 100% coverage from the get-go in this repo.
sorunlib
is tricky because I often can't just interrupt daily operations to test some new functionality. Check out thetests/
directory to see existing tests. New tests for this will go intests/test_wiregrid.py
. There are instructions for running tests in the main README. Also, please merge in the latestmain
, there will be a new code coverage check that runs.
Thanks Brian! Sorry for the late reply and the lack of explanation. I'm replying about some discussion points.
|
c7c2dc0
to
04218dd
Compare
Hi Brian, I editted the
Also, I added some tests in tests/test_wiregrid.py. The coverage is 100%. By the way, I'm leaving the SO collaboration by this month and @sadachi5 is going to take over this PR. |
@BrianJKoopman |
Thanks for the ping, this is on my todo list for tomorrow. |
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.
Thanks @d-hoshino2626 for the changes, especially for implementing the tests! (EDIT: Also, good luck with whatever is next for you after SO!)
@sadachi5, this is looking good, just a couple of small things.
@BrianJKoopman
The remaining issue is about the I think this script is almost ready for implementation. |
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.
This looks good, thank you for the changes.
Sorry my comment on bias_step was wrong. it's consistent among SATs. bias_dets is different but it's not used here, so it should be ok.
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.
@BrianJKoopman I largely modified this script on two points:
1. Split the stream between stopping and spinning up the hwp [add time_constant function #179 (comment)](https://github.com/simonsobs/sorunlib/pull/179#issuecomment-2422445005) 2. Change labeling of hwp rotation direction from `forward`/`backward` to `cw`/`ccw`. [add time_constant function #179 (comment)](https://github.com/simonsobs/sorunlib/pull/179#discussion_r2058890318)
The remaining issue is about the
bias_step
arguments. (I hope this issue will be resolved soon.) #179 (comment)I think this script is almost ready for implementation. Please take another look at it.
Just taking a quick look I like the change from using 'forward'/'backward' everywhere to using 'cw'/'ccw'. However, I would really like to see simonsobs/socs#863 settle and get merged before giving my final review here, as that has direct impact on the relationship between +/- frequency and 'cw'/'ccw' direction.
Rename and move a function: get_direction() --> _get_direction()
Rename hwp.get_direction() --> hwp._get_direction()
rename: hwp.get_direction() --> hwp._get_direction()
Rename: hwp.get_direction() --> hwp._get_direction()
for more information, see https://pre-commit.ci
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.
Rename: hwp.get_direction() --> hwp._get_direction()
Hi @BrianJKoopman , |
I mostly wanted to remove the implied ordering of 'cw' and 'ccw' and drop the references to the correspondance between direction and +/- frequency. This correspondance can change depending on the hardware or agent configuration. In the future this should be hidden by the agents so that a frequency and direction are given. Then within sorunlib we can avoid needing to know the correspondance internally. Other changes are for readability and consistency with overall style within the repo.
Just for readability.
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.
Alright, I think this is as ready as it will be. I'm still not a fan of this hardcoded correspondance between direction and the sign of the frequency:
if target_hwp_direction == 'ccw':
run.hwp.set_freq(freq=2.0)
elif target_hwp_direction == 'cw':
run.hwp.set_freq(freq=-2.0)
current_hwp_direction = target_hwp_direction
This won't improve until the agent is modified though, so I added a note in the comments here for future reference. I think it would be worth removing this, though I expect in the near term the likelihood that this correspondence changes will be low.
Thanks for all the hard work, tracking of different HWP changes, and updates on this one! @sadachi5 @d-hoshino2626 @ykyohei
wiregrid.time_constant
function
I added some APIs for a time constant measurement with the wire grid and the HWP into the
wiregrid.py
.Here is the added functions and its explanation:
_check_wiregrid_position()
_stop_hwp_with_wiregrid()
_spin_hwp_with_wiregrid(target_hwp_direction)
target_hwp_direction
.target_hwp_direction
is bool argument,'forward'
or'backward'
._reverse_hwp_with_wiregrid(initial_hwp_direction, streaming=False, stepwise_before=False, stepwise_after=False)
initial_hwp_direction
using_stop_hwp_with_wiregrid()
and_spin_hwp_with_wiregrid(target_hwp_direction)
stepwise_before
andstepwise_after
are to identify whether performing them or not.time_constant(initial_hwp_direction, stepwise_first=True, stepwise_last=True, stepwise_mid=False, repeat=1)
repeat
, and ejects the wire grid.Any questions and comments are welcome.