예제 #1
0
def make_ratio_integ():
    """
    This is an alternate implementation to that already included in
    make_ratiotem_cubesims
    """
    npixflat = bmasksm_rs.include().sum(axis=0)
    sum321 = cube321.with_mask(bmasksm_rs).sum(axis=0)
    sum303 = cube303.with_mask(bmasksm_rs).sum(axis=0)
    integ303321b = sum321 / sum303
    error303 = cube303.with_mask(~bmasksm_rs).std(axis=0)
    error321 = cube321.with_mask(~bmasksm_rs).std(axis=0)

    eintegratio303321 = ((integ303321b.value**2 *
                          (error303.value**2 /
                           (sum303.value / npixflat)**2 + error321.value**2 /
                           (sum321.value / npixflat)**2))**0.5)

    ok = (integ303321b.value / eintegratio303321) > 3
    integ303321ok = integ303321b.value
    integ303321ok[~ok] = np.nan

    hdu = cube321[0, :, :].hdu
    hdu.data = integ303321ok
    hdu.writeto(paths.hpath('H2CO_321220_to_303202_integ_smoothmask.fits'),
                clobber=True)
    hdu.data = eintegratio303321
    hdu.writeto(paths.hpath('H2CO_321220_to_303202_einteg_smoothmask.fits'),
                clobber=True)
예제 #2
0
def make_ratio_max():
    npixflat = bmasksm_rs.include().sum(axis=0)
    max321 = cube321.with_mask(bmasksm_rs).max(axis=0)
    max303 = cube303.with_mask(bmasksm_rs).max(axis=0)
    maxratio303321b = max321/max303
    error303 = cube303.with_mask(~bmasksm_rs).std(axis=0)
    error321 = cube321.with_mask(~bmasksm_rs).std(axis=0)

    eintegratio303321 = ((maxratio303321b.value**2 * (error303.value**2/(max303.value)**2 +
                                                      error321.value**2/(max321.value)**2))**0.5)

    ok = (maxratio303321b.value/eintegratio303321) > 3
    maxratio303321ok = maxratio303321b.value
    maxratio303321ok[~ok] = np.nan

    hdu = cube321[0,:,:].hdu
    hdu.data = maxratio303321ok
    hdu.writeto(paths.hpath('H2CO_321220_to_303202_maxratio_smoothmask.fits'),clobber=True)
    hdu.data = eintegratio303321
    hdu.writeto(paths.hpath('H2CO_321220_to_303202_emaxratio_smoothmask.fits'),clobber=True)
예제 #3
0
def make_ratio_integ():
    """
    This is an alternate implementation to that already included in
    make_ratiotem_cubesims
    """
    npixflat = bmasksm_rs.include().sum(axis=0)
    sum321 = cube321.with_mask(bmasksm_rs).sum(axis=0)
    sum303 = cube303.with_mask(bmasksm_rs).sum(axis=0)
    integ303321b = sum321/sum303
    error303 = cube303.with_mask(~bmasksm_rs).std(axis=0)
    error321 = cube321.with_mask(~bmasksm_rs).std(axis=0)

    eintegratio303321 = ((integ303321b.value**2 * (error303.value**2/(sum303.value/npixflat)**2 +
                                                   error321.value**2/(sum321.value/npixflat)**2))**0.5)

    ok = (integ303321b.value/eintegratio303321) > 3
    integ303321ok = integ303321b.value
    integ303321ok[~ok] = np.nan

    hdu = cube321[0,:,:].hdu
    hdu.data = integ303321ok
    hdu.writeto(paths.hpath('H2CO_321220_to_303202_integ_smoothmask.fits'),clobber=True)
    hdu.data = eintegratio303321
    hdu.writeto(paths.hpath('H2CO_321220_to_303202_einteg_smoothmask.fits'),clobber=True)
예제 #4
0
def make_ratio_max():
    npixflat = bmasksm_rs.include().sum(axis=0)
    max321 = cube321.with_mask(bmasksm_rs).max(axis=0)
    max303 = cube303.with_mask(bmasksm_rs).max(axis=0)
    maxratio303321b = max321 / max303
    error303 = cube303.with_mask(~bmasksm_rs).std(axis=0)
    error321 = cube321.with_mask(~bmasksm_rs).std(axis=0)

    eintegratio303321 = ((maxratio303321b.value**2 *
                          (error303.value**2 /
                           (max303.value)**2 + error321.value**2 /
                           (max321.value)**2))**0.5)

    ok = (maxratio303321b.value / eintegratio303321) > 3
    maxratio303321ok = maxratio303321b.value
    maxratio303321ok[~ok] = np.nan

    hdu = cube321[0, :, :].hdu
    hdu.data = maxratio303321ok
    hdu.writeto(paths.hpath('H2CO_321220_to_303202_maxratio_smoothmask.fits'),
                clobber=True)
    hdu.data = eintegratio303321
    hdu.writeto(paths.hpath('H2CO_321220_to_303202_emaxratio_smoothmask.fits'),
                clobber=True)
예제 #5
0
noisehdr = fits.getheader(noise_fn)

sm_noise = fits.getdata(mpath('APEX_H2CO_merge_high_plait_all_smooth_noise.fits'))
sm_noise[nhits<20] = np.nan
sm_noise_cube = as_strided(sm_noise, shape=cube303msm.shape,
                           strides=(0,)+sm_noise.strides)

# Cubes masked with noise cube == OK
# (can I make this lazier?)
noisefinite = np.isfinite(noise) # stride length changes for bools?
sm_noisefinite = np.isfinite(sm_noise)
cube303nm = cube303.with_mask(BooleanArrayMask(as_strided(noisefinite,
                                                          shape=cube303.shape,
                                                          strides=(0,)+noisefinite.strides),
                                               cube303.wcs))
cube303nmsm = cube303sm.with_mask(BooleanArrayMask(as_strided(sm_noisefinite,
                                                          shape=cube303sm.shape,
                                                          strides=(0,)+sm_noisefinite.strides),
                                                   cube303sm.wcs))

cube321nm = cube321.with_mask(BooleanArrayMask(as_strided(noisefinite,
                                                          shape=cube321.shape,
                                                          strides=(0,)+noisefinite.strides),
                                               cube321.wcs))
cube321nmsm = cube321sm.with_mask(BooleanArrayMask(as_strided(sm_noisefinite,
                                                          shape=cube321sm.shape,
                                                          strides=(0,)+sm_noisefinite.strides),
                                                   cube321sm.wcs))

log.debug("Noise creation took {0:0.1f} seconds".format(time.time()-t0))
예제 #6
0
                           shape=cube303msm.shape,
                           strides=(0, ) + sm_noise.strides)

# Cubes masked with noise cube == OK
# (can I make this lazier?)
noisefinite = np.isfinite(noise)  # stride length changes for bools?
sm_noisefinite = np.isfinite(sm_noise)
cube303nm = cube303.with_mask(
    BooleanArrayMask(
        as_strided(noisefinite,
                   shape=cube303.shape,
                   strides=(0, ) + noisefinite.strides), cube303.wcs))
cube303nmsm = cube303sm.with_mask(
    BooleanArrayMask(
        as_strided(sm_noisefinite,
                   shape=cube303sm.shape,
                   strides=(0, ) + sm_noisefinite.strides), cube303sm.wcs))

cube321nm = cube321.with_mask(
    BooleanArrayMask(
        as_strided(noisefinite,
                   shape=cube321.shape,
                   strides=(0, ) + noisefinite.strides), cube321.wcs))
cube321nmsm = cube321sm.with_mask(
    BooleanArrayMask(
        as_strided(sm_noisefinite,
                   shape=cube321sm.shape,
                   strides=(0, ) + sm_noisefinite.strides), cube321sm.wcs))

log.debug("Noise creation took {0:0.1f} seconds".format(time.time() - t0))