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

Modifying P_SN after incoherent time averaging #57

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

JianrongTan
Copy link

@jsdillon I have modified the P_SN error bar in single_baseline_postprocessing_and_pspec notebook.

While I am looking at power_spectrum_summary notebook, there is something I am not sure about in the two cells:

# pefrom time average in range set by LST_RANGE_HOURS
lst_subset = uvp.lst_avg_array[(uvp.lst_avg_array >= LST_RANGE_HOURS[0] * np.pi / 12) & (uvp.lst_avg_array <= LST_RANGE_HOURS[1] * np.pi / 12)]
uvp_tavg = uvp.select(lsts=lst_subset, polpairs=[('pI', 'pI')], inplace=False)
uvp_tavg.average_spectra(time_avg=True, error_weights='P_N', error_field=['P_SN'], inplace=True)

In this cell, P_N is not in the error_field.

# correct noise statistics by the coherent average correction factor, which accounts for the FRF
for key in uvp_tavg.get_all_keys():
    uvp_tavg.set_stats('P_N', key, uvp_tavg.get_stats('P_N', key) * dpss_coherent_avg_corrections[key[1]][key[0]]**.5)
    uvp_tavg.set_stats('P_SN', key, uvp_tavg.get_stats('P_SN', key) * dpss_coherent_avg_corrections[key[1]][key[0]]**.5)
    # TODO: Jianrong to figure out whether P_SN should be treated differently here

uvp_tavg seems to have been averaged over interleaves, so there is no such thing like P_S = np.mean([uvp2.get_data(key).real for j, uvp2 in enumerate(uvps_time_avg) if i != j], axis=0) here.

@JianrongTan JianrongTan requested a review from jsdillon February 8, 2025 05:50
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jsdillon
Copy link
Member

On

uvp_tavg.average_spectra(time_avg=True, error_weights='P_N', error_field=['P_SN'], inplace=True)
Would you suggest instead
uvp_tavg.average_spectra(time_avg=True, error_weights='P_N', error_field=['P_SN', 'P_SN'], inplace=True)
?

To get P_S perhaps we should do a temporary de-interleave, then re-interleave? What do you think?

@JianrongTan
Copy link
Author

uvp_tavg.average_spectra(time_avg=True, error_weights='P_N', error_field=['P_SN'], inplace=True) Would you suggest instead uvp_tavg.average_spectra(time_avg=True, error_weights='P_N', error_field=['P_SN', 'P_SN'], inplace=True) ?

Yes. I even think we only need error_field=['P_N'] here.

To get P_S perhaps we should do a temporary de-interleave, then re-interleave? What do you think?

Yes. I think we may need a temporary de-interleave and a re-interleave.

@JianrongTan
Copy link
Author

There seems no need to change the code for error bar estimation in power_spectrum_summary.ipynb .

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.

2 participants