-
Notifications
You must be signed in to change notification settings - Fork 2
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
Don't wait too long for gains to materialise #253
Merged
ludwigschwardt
merged 7 commits into
master
from
SR-965/make-waiting-on-telstate-more-efficient
Oct 24, 2017
Merged
Don't wait too long for gains to materialise #253
ludwigschwardt
merged 7 commits into
master
from
SR-965/make-waiting-on-telstate-more-efficient
Oct 24, 2017
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This allows the script to continue as soon as the cal pipeline products materialise in telstate, instead of sleeping for the worst case time. Consolidate all product retrievals in a single routine (DRY). Use the same delaycal routine for both phaseup and calibrate_delays, and resign ourselves to the fact that katsdpcal will forever have delay solutions with the wrong sign (which at least makes interpretation of historic solutions sane). This addresses JIRA ticket SR-965.
The script has moved back to observation as it actually captures data and puts data products into the archive, and that version is now more up to date.
The solution extractors in reference_pointing are slightly different to the phaseup family as it is based on explicit start and end times. There is probably some benefit to merge the two approaches in future, but for now simply wait for the last piece of the puzzle.
Stub this out to pass through dry-running (rather add wait to TimeSession next time around...).
When the cal pipeline encounters completely flagged channels (typically the static RFI mask) it returns bandpass gains that are NaNs in those channels. No-one likes NaNs though, especially not the correlator. The existing scheme replaced them with gains of 1.0 + 0.0j, which is quite arbitrary. This caused step changes in the bandpass amplitude and phase, which had been ignored until Mattieu recently introduced the --flatten-bandpass option. The new solution uses rudimentary linear interpolation across the flagged regions via np.interp (which works on complex values too and interpolates real + imag separately as far as I can tell). In addition, if all channels are flagged for some reason, ignore the bandpass gains for that input. This addresses JIRA ticket SR-956.
rubyvanrooyen
approved these changes
Oct 20, 2017
spassmoor
approved these changes
Oct 24, 2017
ludwigschwardt
deleted the
SR-965/make-waiting-on-telstate-more-efficient
branch
October 24, 2017 08:57
ludwigschwardt
added a commit
that referenced
this pull request
Feb 18, 2019
Some history first... The original phase-up script had a fixed magnitude for the F-engine gains (aka gain corrections) that was constant for all inputs and frequency channels (let's say 70 for the purpose of this commit message). It really only adjusted the phases per input and per channel to phase up the beamformer: (1) corrections = 70 * abs(gains) / gains The first version of --flatten-bandpass (#252, #253, Oct 2017) had (2) corrections = 70 / gains which flattened the bandpass magnitude but unfortunately also introduced an arbitrary scaling, since the gains have the arbitrary units of sqrt(Jy / count). This caused clipping and/or quantisation loss on some F-engine outputs. The next version of --flatten-bandpass (#331 redone as #335, Nov 2018) addressed this by normalising by the mean gain over the band per input: (3) corrections = 70 * average_over_frequency(gains) / gains While this removed all the bumps in the bandpass of each input, it left the average correction magnitude stuck at 70 for all inputs, thereby not equalising the average gain per input. This leads to some H / V mismatch as well as potential correlator / beamformer inefficiency. The proposed change addresses this equalisation issue. The gain correction calculation is collected in its own function to clean up the main script flow and allow simpler testing. The average gain is now calculated over all inputs and all frequency channels, using a more robust succession of medians that ignore flagged gains, as (4) corrections = 70 * global_average(gains) / gains The average (relative) gain per input is also reported as a diagnostic, and the script refuses to continue if all the corrections will be zero (which implies zero signal out of the beamformer).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a bit of a mish-mash, mandated by available telescope time...
The main aim is to reduce the amount of time spent waiting for cal products to materialise in telstate. Ever since katsdptelstate PR #39 telstate allows timestamps to be checked in its
wait_key
method, which allows the script to wait until a fresh cal product arrives. The script therefore waits for the last expected cal product with a worst-case timeout, but should return as soon as possible. Standardise the telstate interactions between the various scripts (bf_phaseup
/calibrate_delays
/basic_health
/reference_pointing
). This addresses JIRA ticket SR-965.The secondary aim is to flatten the bandpass amplitudes during phaseup. This builds on the new
--flatten-bandpass
option introduced by #252. That change showed that it was necessary to interpolate bandpass gains across NaNs representing flagged channels, instead of merely setting NaNs to 1.0 which introduces step changes in amplitude and phase. Use the simplistic linear interpolation provided bynp.interp
as it is reasonably robust. This addresses JIRA ticket SR-956.A last minor change is the removal of the
basic_health.py
script still lurking in theutility
directory. It has moved toobservation
a while ago.