diff --git a/notebooks/single_baseline_postprocessing_and_pspec.ipynb b/notebooks/single_baseline_postprocessing_and_pspec.ipynb index 4c2e173..c9e62ab 100644 --- a/notebooks/single_baseline_postprocessing_and_pspec.ipynb +++ b/notebooks/single_baseline_postprocessing_and_pspec.ipynb @@ -7,7 +7,7 @@ "source": [ "# Single Baseline Filtering and Power Spectrum Estimation\n", "\n", - "**by Josh Dillon, Bobby Pascua, and Mike Wilensky**, last updated November 5, 2024\n", + "**by Josh Dillon, Bobby Pascua, and Mike Wilensky**, last updated January 6, 2025\n", "\n", "This notebook is designed to take a single redundantly-averaged unique baseline (typically after LST-binning) and push it through all the way to the power spectrum. It operates on single files that contain a single baseline for all LSTs and both `'ee'` and `'nn'` polarizations. It then can:\n", "* Throw out highly flagged times and/or channels\n", @@ -787,30 +787,6 @@ " nsamples[ap + (pstokes,)] = combined_nsamples" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "79e04ba6", - "metadata": {}, - "outputs": [], - "source": [ - "# TODO: graduate this function into hera_cal\n", - "\n", - "def deinterleave_datacontainer(dc, ninterleave=NINTERLEAVE, tslice=slice(None)):\n", - " '''Breaks datacontainers into ninterleave separate containers and returns a list of deinterleaved datacontainers.\n", - " Also updates .times and .lsts attributes. Integrations at the end that do not evenly divide are dropped.'''\n", - " deint_dcs = []\n", - " for i in range(ninterleave):\n", - " islice = slice(i, (len(dc.times[tslice]) // ninterleave) * ninterleave, ninterleave) # ensures all slices have same shape\n", - " new_dc = copy.deepcopy(dc)\n", - " new_dc.times = dc.times[tslice][islice]\n", - " new_dc.lsts = dc.lsts[tslice][islice]\n", - " for bl in new_dc:\n", - " new_dc[bl] = dc[bl][tslice, :][islice, :]\n", - " deint_dcs.append(new_dc)\n", - " return deint_dcs" - ] - }, { "cell_type": "code", "execution_count": null, @@ -1067,10 +1043,10 @@ "outputs": [], "source": [ "# perform deinterleaving\n", - "deint_filt_data = deinterleave_datacontainer(filt_data, ninterleave=NINTERLEAVE, tslice=tslice)\n", - "deint_flags = deinterleave_datacontainer(filt_flags, ninterleave=NINTERLEAVE, tslice=tslice)\n", - "deint_nsamples = deinterleave_datacontainer(filt_nsamples, ninterleave=NINTERLEAVE, tslice=tslice)\n", - "deint_wgts = deinterleave_datacontainer(time_filt_wgts, ninterleave=NINTERLEAVE, tslice=tslice)" + "deint_filt_data = filt_data.deinterleave(NINTERLEAVE, tslice=tslice)\n", + "deint_flags = filt_flags.deinterleave(NINTERLEAVE, tslice=tslice)\n", + "deint_nsamples = filt_nsamples.deinterleave(NINTERLEAVE, tslice=tslice)\n", + "deint_wgts = time_filt_wgts.deinterleave(NINTERLEAVE, tslice=tslice)" ] }, {