Skip to content

Commit

Permalink
Merge pull request #121 from mwilensky768/ins_compatibility
Browse files Browse the repository at this point in the history
Closes #119
  • Loading branch information
mwilensky768 authored Oct 16, 2023
2 parents e95b824 + 353bc51 commit 56660cc
Show file tree
Hide file tree
Showing 12 changed files with 461 additions and 254 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fetch-depth: 1

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2.0.0
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniconda-version: "latest"
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# SSINS Change Log

## Unreleased
- Handle some optional phasing keywords correctly when they are not present
- Now requires pyuvdata 2.4.1, which introduces several new required parameters for
UVData (thus SS) and UVFlag (thus INS). This required refactoring the INS constructor,
though the API has been preserved. However, if reading SSINS h5 files written with an earlier
pyuvdata version, there may be an error issued from pyuvdata about the new required keywords.
In this case, one will need to specify the originating telescope of the file, or disable run_check to proceed.
- Changed how `_data_params` property is handled.


## 1.4.6
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SSINS is a python package intended for radio frequency interference flagging in
## Dependencies

**python3** is now required. Support for python2 has been dropped.<br/>
**pyuvdata 2.2.8 or newer**.<br/>
**pyuvdata 2.4.1 or newer**.<br/>
**pyuvdata has its own dependencies!**<br/>
See https://github.com/RadioAstronomySoftwareGroup/pyuvdata.
**pyyaml 5.3.1 or newer** also for reading and writing SSINS outputs.
Expand Down
Binary file modified SSINS/data/1061312640_mix_auto_SSINS_data.h5
Binary file not shown.
Binary file modified SSINS/data/1061312640_mix_cross_SSINS_data.h5
Binary file not shown.
Binary file modified SSINS/data/1061313128_99bl_1pol_half_time_SSINS.h5
Binary file not shown.
Binary file not shown.
328 changes: 239 additions & 89 deletions SSINS/incoherent_noise_spectrum.py

Large diffs are not rendered by default.

38 changes: 20 additions & 18 deletions SSINS/sky_subtract.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def read(self, filename, diff=False, flag_choice=None, INS=None, custom=None,
" conflicts with UVData.read.", category=PendingDeprecationWarning)

super().read(filename, **kwargs)
if self.Nphase > 1:
raise NotImplementedError("SSINS cannot handle files with more than one phase center.")

if (self.data_array is not None):
if diff:
Expand Down Expand Up @@ -180,7 +182,7 @@ def diff(self, flag_choice=None, INS=None, custom=None):

blt_slice = slice(blstart, blstart + len_diff)
self.data_array[blt_slice, :, :, :] = diff_dat
"""The differenced visibilities. Complex array of shape (Nblts, Nspws, Nfreqs, Npols). Can be differenced in both time and frequency."""
"""The differenced visibilities. Complex array of shape (Nblts, Nspws, Nfreqs, Npols)."""
self.flag_array[blt_slice, :, :, :] = diff_flags
"""The flag array, which results from boolean OR of the flags corresponding to visibilities that are differenced from one another."""

Expand All @@ -196,16 +198,19 @@ def diff(self, flag_choice=None, INS=None, custom=None):
diff_uvw = self.uvw_array[where_bl]
diff_uvw = 0.5 * (diff_uvw[:-1] + diff_uvw[1:])

# pyuvdata 2.2 optional parameters
if(hasattr(self, 'phase_center_app_dec') and (self.phase_center_app_dec is not None)):
diff_pcad = self.phase_center_app_dec[where_bl]
diff_pcad = 0.5 * (diff_pcad[:-1] + diff_pcad[1:])
if(hasattr(self, 'phase_center_app_ra') and (self.phase_center_app_ra is not None)):
diff_pcar = self.phase_center_app_ra[where_bl]
diff_pcar = 0.5 * (diff_pcar[:-1] + diff_pcar[1:])
if(hasattr(self, 'phase_center_frame_pa') and (self.phase_center_frame_pa is not None)):
diff_pcfp = self.phase_center_frame_pa[where_bl]
diff_pcfp = 0.5 * (diff_pcfp[:-1] + diff_pcfp[1:])


diff_pcad = self.phase_center_app_dec[where_bl]
diff_pcad = 0.5 * (diff_pcad[:-1] + diff_pcad[1:])
self.phase_center_app_dec[blt_slice] = diff_pcad

diff_pcar = self.phase_center_app_ra[where_bl]
diff_pcar = 0.5 * (diff_pcar[:-1] + diff_pcar[1:])
self.phase_center_app_ra[blt_slice] = diff_pcar

diff_pcfp = self.phase_center_frame_pa[where_bl]
diff_pcfp = 0.5 * (diff_pcfp[:-1] + diff_pcfp[1:])
self.phase_center_frame_pa[blt_slice] = diff_pcfp

self.integration_time[blt_slice] = diff_ints
"""Total amount of integration time (sum of the differenced visibilities) at each baseline-time (length Nblts)"""
Expand All @@ -222,13 +227,10 @@ def diff(self, flag_choice=None, INS=None, custom=None):

blt_attr_names = ['data_array', 'flag_array', 'time_array',
'nsample_array', 'integration_time', 'baseline_array',
'ant_1_array', 'ant_2_array', 'uvw_array']
if(hasattr(self, 'phase_center_app_dec') and (self.phase_center_app_dec is not None)):
blt_attr_names.append('phase_center_app_dec')
if(hasattr(self, 'phase_center_app_ra') and (self.phase_center_app_ra is not None)):
blt_attr_names.append('phase_center_app_ra')
if(hasattr(self, 'phase_center_frame_pa') and (self.phase_center_frame_pa is not None)):
blt_attr_names.append('phase_center_frame_pa')
'ant_1_array', 'ant_2_array', 'uvw_array',
'phase_center_app_dec', 'phase_center_app_ra', 'phase_center_frame_pa',
'phase_center_id_array']

for blts_attr in blt_attr_names:
setattr(self, blts_attr, getattr(self, blts_attr)[:-self.Nbls])

Expand Down
Loading

0 comments on commit 56660cc

Please sign in to comment.