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

ss/deconvolving ringmap #126

Merged
merged 9 commits into from
May 27, 2021
Merged

ss/deconvolving ringmap #126

merged 9 commits into from
May 27, 2021

Conversation

ssiegelx
Copy link
Contributor

refactor(ringmapmaker): refactor DeconvolveHybridM

  • Move most of the contents of DeconvolveHybridM into
    DeconvolveHybridMBase.

  • Create subclasses that enable the user to deconvolve either the
    driftscan analytical beam model or an external beam model.

  • Create subclasses that enable a Tikhonov scheme for deconvolution
    that uses a single regularisation parameter, or Weiner scheme that
    assumes some model for the m-mode power spectrum of the signal.

  • DeconvolveHybridMBase now computes the el-dependent EW dirty beam
    and saves it to the output RingMap container if requested.

  • DeconvolveHybridMBase now normalizes by the el-dependent
    peak of the dirty beam so that point source peak flux is
    preserved through the map making process.

  • Create beam.py module and CreateBeamStream task that takes a
    CommonModeGridBeam container and converts it to a HybridVisStream
    container that can be m-mode transformed and used in the
    deconvolving ringmapmakers.

  • Add an el axis to the weight dataset in the RingMap container,
    since the noise after deconvolution will be el dependent.

  • Propagate noise variance through the deconvolution process.
    Create RADependentWeight task that re-introduces the RA dependence
    to the weights that was lost in the round-trip m-mode transform.
    Applying this procedure to Gaussian noise realizations recovers
    the standard deviation of the noise at the <10% level.

Branches off deconvolving-ringmap (PR #122)

@ssiegelx ssiegelx requested review from jrs65 and wulfda02 March 23, 2021 19:01
@ssiegelx ssiegelx mentioned this pull request Mar 23, 2021
@lgtm-com
Copy link

lgtm-com bot commented Mar 23, 2021

This pull request introduces 1 alert and fixes 1 when merging 537a0e4 into 0c4b397 - view on LGTM.com

new alerts:

  • 1 for Unused import

fixed alerts:

  • 1 for Unnecessary pass

@wulfda02
Copy link

@ssiegelx Here is what I have been using for the sky covariance:

def S(f,m):
    dfse = 2 * np.power(f/600., -3.5) * np.power(m, -1.5)
    psrc = 2e-3 * np.power(f/600., -2)
    return np.sqrt(dfse**2 + psrc**2)

Attached, I've plotted this function over the m-transform of a deconvolved ringmap (absolute square, so units of Jy^2). The different colors are different frequencies, which have been artificially shifted so they don't lay on top of each other. Note that this is not a fit---just tweaked by eye.

sky_covar.pdf

The dashed lines correspond to the equivalent prior inv_SN = 1e-6 that's currently in the code, assuming that the variance is ~1e-8 Jy^2. Based on these plots, I think we are over-estimating the signal to noise at high m with the default prior. Hopefully that's consistent with what @jrs65 has found---that a larger inv_SN works better.

@jrs65
Copy link
Contributor

jrs65 commented Mar 29, 2021

@ssiegelx I didn't find that I needed to tweak the SN parameter very much. It looks like I was using 1e-5 in my runs.

@ssiegelx
Copy link
Contributor Author

Thanks @wulfda02 and @jrs65.

I generated maps using a range of values for inv_s2n. This pdf file summarizes the results:

inv_s2n_noise_optimization_driftscan_compressed.pdf

Page 2 shows the expected thermal noise as a function of inv_s2n (relative to the noise at the default inv_s2n = 1e-6). Increasinginv_s2n from 1e-6 to 1e-5 results in a 30% reduction in the standard deviation for XX pol and 12.5% for YY pol. I think this explains a decent chunk of the discrepancy between the noise in the ringmap stack versus the beam former stack.

Increasing inv_s2n from 1e-5 to 1e-4 does not reduce the noise further by much (roughly 7.5% for XX pol and 2.5% YY pol). So 1e-5 seems like a good number.

The maps at a single frequency are shown on pg 3. They don't look very different to me. However pg 4 and pg 5 show a slice through two different point sources. You can see that the ability to deconvolve the beam degrades as you increase inv_s2n, as evident by the ratio of the peak response to the grating lobe response.

@lgtm-com
Copy link

lgtm-com bot commented Apr 18, 2021

This pull request introduces 1 alert and fixes 1 when merging 78c08f8 into 6135579 - view on LGTM.com

new alerts:

  • 1 for Unused import

fixed alerts:

  • 1 for Unnecessary pass

Copy link

@wulfda02 wulfda02 left a comment

Choose a reason for hiding this comment

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

I'm not really qualified to asses changes to core.io and core.task, but everything else looks good to me. My two comments are minor accounting details, not something that will break anything.

draco/analysis/beam.py Outdated Show resolved Hide resolved
draco/analysis/ringmapmaker.py Outdated Show resolved Hide resolved
Seth Siegel and others added 2 commits May 18, 2021 21:49
- Move most of the contents of DeconvolveHybridM into
DeconvolveHybridMBase.

- Create subclasses that enable the user to deconvolve either the
driftscan analytical beam model or an external beam model.

- Create subclasses that enable a Tikhonov scheme for deconvolution
that uses a single regularisation parameter, or Weiner scheme that
assumes some model for the m-mode power spectrum of the signal.

- DeconvolveHybridMBase now computes the el-dependent EW dirty beam
and saves it to the output RingMap container if requested.

- DeconvolveHybridMBase now normalizes by the el-dependent
peak of the dirty beam so that point source peak flux is
preserved through the map making process.

- Create beam.py module and CreateBeamStream task that takes a
CommonModeGridBeam container and converts it to a HybridVisStream
container that can be m-mode transformed and used in the
deconvolving ringmapmakers.

- Add an el axis to the weight dataset in the RingMap container,
since the noise after deconvolution will be el dependent.

- Propagate noise variance through the deconvolution process.
Create RADependentWeight task that re-introduces the RA dependence
to the weights that was lost in the round-trip m-mode transform.
Applying this procedure to Gaussian noise realizations recovers
the standard deviation of the noise at the <10% level.
This also makes dirty_beam an optional dataset of HybridVisStream.
@jrs65
Copy link
Contributor

jrs65 commented May 19, 2021

@ssiegelx I've forced pushed a branch with the conflicts resolved so it's easier to see what's changed. In case that's gone wrong at all the original commit hash is 78c08f8914f4831ed3f14f4da550d1b0f26d8f37

Copy link
Contributor

@jrs65 jrs65 left a comment

Choose a reason for hiding this comment

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

@ssiegelx this looks great. Just a few comments, the biggest being that Wiener is incorrectly spelled everywhere (currently Weiner is used)

draco/analysis/ringmapmaker.py Outdated Show resolved Hide resolved
draco/analysis/ringmapmaker.py Outdated Show resolved Hide resolved
draco/analysis/ringmapmaker.py Outdated Show resolved Hide resolved
Seth Siegel and others added 6 commits May 20, 2021 15:26
Use the model suggested by Dallas for the signal power spectrum
in the Wiener ring map maker. The model spectrum has contributions from
galactic synchrotron and extragalactic point source emission.  The
galactic emission has a power-law dependence on both m and frequency.
The point source emission has a power-law dependence on frequency only.
Set the default parameters to those suggested by Dallas.
Add the capability to DeconvolveHybridMBase to apply a window
to the deconvolved m-mode transform of the ringmap.  This can
be used to shape the synthesized beam in the EW direction.
Provides an option to use the same window for all frequencies
to try to produce a frequency-independent synthesized beam.
@ssiegelx
Copy link
Contributor Author

I think this PR is ready. I've addressed the comments and also add several features that I had in my local version, specifically: use the prior Dallas suggested for the Wiener ringmap maker, add capability to apply a window to shape synthesized beam, and fix a bug in how the number of RA samples was being calculated.

It was failing the ci tests because cora now requires python >= 3.7. I changed the GitHub workflow in the same way as was done in this commit. However, it still says that it need to run the tests for python 3.6 and 3.8, but never does. Any ideas how to fix this? Should draco's minimum python requirement in setup.py also be bumped up to 3.7?

@jrs65 jrs65 self-requested a review May 27, 2021 22:11
@jrs65
Copy link
Contributor

jrs65 commented May 27, 2021

@ssiegelx this looks good to me. I think I beat you with merging a commit to get the CI working again, so you may need to rebase to get rid of any conflict.

I wondered about the minimum version in setup.py, in theory there's nothing about draco itself that can't support Python 3.6, it's just the dependency. I think maybe we should bump it though to try and keep things a bit more uniform across the repos.

@ssiegelx ssiegelx merged commit f6621a9 into master May 27, 2021
@ssiegelx ssiegelx deleted the ss/deconvolving-ringmap branch May 27, 2021 23:05
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