示例#1
0
 def apply(self, tod):
     nmat.apply_window(tod, self.window)
     ft = fft.rfft(tod)
     self.nmat.apply_ft(ft, tod.shape[-1], tod.dtype)
     if self.filter is not None: ft *= self.filter
     fft.irfft(ft, tod, flags=['FFTW_ESTIMATE','FFTW_DESTROY_INPUT'])
     nmat.apply_window(tod, self.window)
     return tod
示例#2
0
	def __init__(self, data, model=None, window=None):
		model  = config.get("noise_model", model)
		window = config.get("tod_window", window)*data.srate
		nmat.apply_window(data.tod, window)
		self.nmat = nmat_measure.NmatBuildDelayed(model, cut=data.cut_noiseest, spikes=data.spikes[:2].T)
		self.nmat = self.nmat.update(data.tod, data.srate)
		nmat.apply_window(data.tod, window, inverse=True)
		self.model, self.window = model, window
		self.ivar = self.nmat.ivar
		self.cut  = data.cut
示例#3
0
 def __init__(self, scan, model=None, window=None, filter=None):
     model  = config.get("noise_model", model)
     window = config.get("tod_window", window)*scan.srate
     nmat.apply_window(scan.tod, window)
     self.nmat = nmat_measure.NmatBuildDelayed(model, cut=scan.cut_noiseest, spikes=scan.spikes)
     self.nmat = self.nmat.update(scan.tod, scan.srate)
     nmat.apply_window(scan.tod, window, inverse=True)
     self.model, self.window = model, window
     self.ivar = self.nmat.ivar
     self.cut  = scan.cut
     # Optional extra filter
     if filter:
         freq = fft.rfftfreq(scan.nsamp, 1/scan.srate)
         fknee, alpha = filter
         with utils.nowarn():
             self.filter = (1 + (freq/fknee)**-alpha)**-1
     else: self.filter = None
示例#4
0
 def white(self, tod):
     nmat.apply_window(tod, self.window)
     self.nmat.white(tod)
     nmat.apply_window(tod, self.window)
示例#5
0
文件: mapmaking.py 项目: jit9/enlib
 def __call__(self, scan, tod):
     nsamp = int(self.width * scan.srate)
     nmat.apply_window(tod, nsamp)
示例#6
0
     d = actscan.ACTScan(entry)
     if d.ndet == 0 or d.nsamp == 0:
         raise errors.DataMissing("Tod contains no valid data")
 except errors.DataMissing as e:
     L.debug("Skipped %s (%s)" % (str(id), str(e)))
     continue
 L.debug("Read %s" % id)
 d = d[:, ::config.get("downsample")]
 if args.ndet > 0: d = d[:args.ndet]
 # Get our samples
 tod = d.get_samples()
 tod -= np.mean(tod, 1)[:, None]
 tod = tod.astype(dtype)
 # Construct noise model for this tod
 winsize = int(config.get("tod_window") * d.srate)
 nmat.apply_window(tod, winsize)
 d.noise = d.noise.update(tod, d.srate)
 L.debug("Noise %s" % id)
 # Apply it, to get N"d
 d.noise.apply(tod)
 nmat.apply_window(tod, winsize)
 # Compute the variance per detector. If our noise model
 # were correct and our data were pure noise, this would be
 # N"<nn'>N" = N". But our noise model isn't totally accurate.
 vars = np.var(tod, 1)
 # Project each detectors result on the sky
 tod[:] = vars[:, None]
 pmap = pmat.PmatMap(d, osig)
 pcut = pmat.PmatCut(d)
 junk = np.zeros(pcut.njunk, dtype=dtype)
 pcut.backward(tod, junk)
示例#7
0
		d = actscan.ACTScan(entry)
		if d.ndet == 0 or d.nsamp == 0:
			raise errors.DataMissing("Tod contains no valid data")
	except errors.DataMissing as e:
		L.debug("Skipped %s (%s)" % (str(id), e.message))
		continue
	L.debug("Read %s" % id)
	d = d[:,::config.get("downsample")]
	if args.ndet > 0: d = d[:args.ndet]
	# Get our samples
	tod = d.get_samples()
	tod -= np.mean(tod,1)[:,None]
	tod  = tod.astype(dtype)
	# Construct noise model for this tod
	winsize = int(config.get("tod_window")*d.srate)
	nmat.apply_window(tod, winsize)
	d.noise = d.noise.update(tod, d.srate)
	L.debug("Noise %s" % id)
	# Apply it, to get N"d
	d.noise.apply(tod)
	nmat.apply_window(tod, winsize)
	# Compute the variance per detector. If our noise model
	# were correct and our data were pure noise, this would be
	# N"<nn'>N" = N". But our noise model isn't totally accurate.
	vars = np.var(tod,1)
	# Project each detectors result on the sky
	tod[:] = vars[:,None]
	pmap = pmat.PmatMap(d, osig)
	pcut = pmat.PmatCut(d)
	junk = np.zeros(pcut.njunk, dtype=dtype)
	pcut.backward(tod, junk)
示例#8
0
	def apply(self, tod):
		nmat.apply_window(tod, self.window)
		self.nmat.apply(tod)
		nmat.apply_window(tod, self.window)
		return tod