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

Autos only abs amp logcal #832

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

Autos only abs amp logcal #832

wants to merge 7 commits into from

Conversation

ele-rath
Copy link

changed steps 1 and 2 in post_redcal_abscal_run

@zacharymartinot
Copy link
Contributor

I think passing both autos_only_abs_amp_logcal=True and use_abs_amp_lincal=True should be considered inconsistent input, and maybe raise an error, since Abscal Step 5 essentially overwrites step 1.

@codecov
Copy link

codecov bot commented Sep 28, 2022

Codecov Report

Base: 97.14% // Head: 97.06% // Decreases project coverage by -0.08% ⚠️

Coverage data is based on head (b78192b) compared to base (3afed09).
Patch coverage: 92.30% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #832      +/-   ##
==========================================
- Coverage   97.14%   97.06%   -0.09%     
==========================================
  Files          18       16       -2     
  Lines        8445     8101     -344     
==========================================
- Hits         8204     7863     -341     
+ Misses        241      238       -3     
Impacted Files Coverage Δ
hera_cal/abscal.py 95.69% <92.30%> (-1.07%) ⬇️
hera_cal/__init__.py
hera_cal/apply_cal.py
hera_cal/redcal.py 99.31% <0.00%> (+<0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@jsdillon jsdillon left a comment

Choose a reason for hiding this comment

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

Nice work @ele-rath, but I think this could be made a fair bit simpler. Slack me if you want to chat about how or if my comments are confusing.

@@ -3436,29 +3443,62 @@ def post_redcal_abscal(model, data, data_wgts, rc_flags, edge_cut=0, tol=1.0, ke
data_wgts=data_wgts, tol=tol, keep_flagged_ants=True)
reds = redcal.get_reds(idealized_antpos, pols=data.pols(), bl_error_tol=redcal.IDEALIZED_BL_TOL)

# separate autos and crosses if running amplitude calibration with autos only:
Copy link
Member

Choose a reason for hiding this comment

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

I think you've made this function way more complicated than it needs to be. Instead of splitting up the passed data and model, I think instead one should pass in a separate autos_model and autos_data, which default to None but must be specified if autos_only_abs_amp_logcal is True

Copy link
Author

Choose a reason for hiding this comment

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

I think this makes sense, and I will make this change

@@ -3212,6 +3212,13 @@ def match_baselines(data_bls, model_bls, data_antpos, model_antpos=None, pols=[]
data_bl_to_load = set(utils.filter_bls(data_bls, pols=pols, antpos=data_antpos, min_bl_cut=min_bl_cut, max_bl_cut=max_bl_cut))
model_bl_to_load = set(utils.filter_bls(model_bls, pols=pols, antpos=model_antpos, min_bl_cut=min_bl_cut, max_bl_cut=max_bl_cut))

#Add autos to bl_to_load if we are running with autos_only_abs_amp_logcal:
if autos_only_abs_amp_logcal:
autos_data = [bl for bl in data_bls if bl[0]==bl[1] and bl[2] in pols]
Copy link
Member

Choose a reason for hiding this comment

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

I'd be careful about using bl[0] == bl[1] for finding autos, since you might end up identifying (1, 1, 'ne') as an auto, which it's not. Instead use utils.split_bl()

df = np.median(np.diff(data.freqs))
for time_avg in [True, False]: # first use the time-averaged solution to try to avoid false minima
gains_here = delay_slope_lincal(model, data, idealized_antpos, wgts=binary_wgts, df=df, f0=data.freqs[0], medfilt=True, kernel=kernel,
if autos_only_abs_amp_logcal:
Copy link
Member

Choose a reason for hiding this comment

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

Having a separate call to each calibration function depending on whether autos_only_abs_amp_logcal is true or makes the code a lot more complex and annoying to test and maintain.

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