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 time_constant function #179

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

d-hoshino2626
Copy link

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:

  1. _check_wiregrid_position()
    • This function checks the wire grid is off the window or on the window from the logs for the limit switches.
  2. _stop_hwp_with_wiregrid()
    • This function confirms the wire grid is on the window and stops the HWP.
  3. _spin_hwp_with_wiregrid(target_hwp_direction)
    • This function confirms the wire grid is on the window and spins up the HWP in the direction same as target_hwp_direction.
    • target_hwp_direction is bool argument, 'forward' or 'backward'.
  4. _reverse_hwp_with_wiregrid(initial_hwp_direction, streaming=False, stepwise_before=False, stepwise_after=False)
    • This function reverses the HWP spinning direction from initial_hwp_direction using _stop_hwp_with_wiregrid() and _spin_hwp_with_wiregrid(target_hwp_direction)
    • Also, the stepwise rotation can be performed before and/or after the reversing. The bool arguments stepwise_before and stepwise_after are to identify whether performing them or not.
    • SMuRF streaming can be performed during the stepwise rotation and HWP speed change.
  5. time_constant(initial_hwp_direction, stepwise_first=True, stepwise_last=True, stepwise_mid=False, repeat=1)
    • This is the main public API. This function inserts the wire grid, changes the HWP direction as many times as repeat, and ejects the wire grid.
    • Also, it takes bias steps before and after the insertion and ejection, execute the stepwise rotations before, in the middle of, or after the HWP direction changes.

Any questions and comments are welcome.

@ykyohei ykyohei self-requested a review October 17, 2024 14:41
Copy link

@ykyohei ykyohei left a 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.

  1. 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.

  2. 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 bacause hwp_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.

if stepwise_before:
rotate(False)
# Stop the HWP
_stop_hwp_with_wiregrid()
Copy link

Choose a reason for hiding this comment

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

I suggest to add following here, to stream separately for forward and backward

run.smurf.stream('off')
run.smurf.stream('on')

@d-hoshino2626
Copy link
Author

Thanks Kyohei!

  1. I consulted with Hironobu about whether it is better to separate the stream or not and his opinion was not to separate. I heard from him that the HWP pipeline works well if the stream is separated properly by analysis and it is not difficult. He will mainly work on this analysis, so it would be better to follow his opinion, I think.
  2. Thanks for your information! I will re-write it using apply_hwp_angle_model(tod, on_sign_ambiguous='offcenter').

Copy link
Contributor

@sadachi5 sadachi5 left a 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().

run.smurf.bias_step(tag=bs_tag, concurrent=True)

# Insert the wiregrid
insert()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add detector streams during the insert() and eject(), and add sleep (5 sec?) before and after the insert()/eject()?
Sleep times have two purposes. One is to see the detector response with/without the wiregrid right before and after the insertion/ejection. The second is to wait for the wiregrid to be stable before the bias-step measurement.

run.smurf.bias_step(tag=bs_tag, concurrent=True)

# Eject the wiregrid
eject()
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, I want to add also detector stream ON --> sleep --> eject --> sleep.

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.

3 participants