Skip to content

Commit

Permalink
Merge pull request #3 from mathias77515/Tom-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias77515 authored Feb 7, 2024
2 parents 0acdbc1 + 774db06 commit 7be87c4
Show file tree
Hide file tree
Showing 27 changed files with 11,944 additions and 1,430 deletions.
Binary file modified mapmaking/__pycache__/frequency_acquisition.cpython-38.pyc
Binary file not shown.
Binary file modified mapmaking/__pycache__/instrument.cpython-38.pyc
Binary file not shown.
Binary file modified mapmaking/__pycache__/noise_timeline.cpython-38.pyc
Binary file not shown.
Binary file modified mapmaking/__pycache__/planck_timeline.cpython-38.pyc
Binary file not shown.
Binary file modified mapmaking/__pycache__/systematics.cpython-38.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion mapmaking/frequency_acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def get_hitmap(self, nside=None):
return hit

def get_noise(self, det_noise, photon_noise, seed=None, out=None):

np.random.seed(seed)
out = self.instrument.get_noise(
self.sampling, self.scene, det_noise, photon_noise, out=out)
Expand Down Expand Up @@ -1925,7 +1926,6 @@ def get_invntt_operator(self, det_noise, photon_noise150, photon_noise220):
return (invn150 + invn220)/2 # factor 2 because it added twice the detector noise

def get_noise(self, det_noise, photon_noise150, photon_noise220, seed=None):

np.random.seed(seed)
ndet = self.subacqs150[0].get_noise(det_noise, False)
npho150 = self.subacqs150[0].get_noise(False, photon_noise150)# - ndet
Expand Down
26 changes: 15 additions & 11 deletions mapmaking/noise_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

class QubicNoise:

def __init__(self, band, npointings, comm=None, size=1, detector_nep=4.7e-17):
def __init__(self, band, npointings, comm=None, size=1, detector_nep=4.7e-17, seed=None):

if band != 150 and band != 220:
raise TypeError('Please choose the QubicWideBandNoise method.')

dictfilename = 'dicts/pipeline_demo.dict'
d = qubic.qubicdict.qubicDict()
d.read_from_file(dictfilename)

self.seed = seed
d['TemperatureAtmosphere150']=None
d['TemperatureAtmosphere220']=None
d['EmissivityAtmosphere150']=None
Expand Down Expand Up @@ -41,10 +41,10 @@ def get_noise(self, det_noise, pho_noise):
return n

def photon_noise(self):
return self.acq.get_noise(det_noise=False, photon_noise=True)
return self.acq.get_noise(det_noise=False, photon_noise=True, seed=self.seed)

def detector_noise(self):
return self.acq.get_noise(det_noise=True, photon_noise=False)
return self.acq.get_noise(det_noise=True, photon_noise=False, seed=self.seed)

def total_noise(self, wdet, wpho):
ndet = wdet * self.detector_noise()
Expand All @@ -61,10 +61,12 @@ def __init__(self, d, npointings, detector_nep=4.7e-17):
self.detector_nep = detector_nep


def total_noise(self, wdet, wpho150, wpho220):
def total_noise(self, wdet, wpho150, wpho220, seed=None):

Qubic150 = QubicNoise(150, self.npointings, comm=self.d['comm'], size=self.d['nprocs_instrument'], detector_nep=self.detector_nep)
Qubic220 = QubicNoise(220, self.npointings, comm=self.d['comm'], size=self.d['nprocs_instrument'], detector_nep=self.detector_nep)
Qubic150 = QubicNoise(150, self.npointings, comm=self.d['comm'], size=self.d['nprocs_instrument'], detector_nep=self.detector_nep, seed=seed)
if seed is not None :
seed += 1
Qubic220 = QubicNoise(220, self.npointings, comm=self.d['comm'], size=self.d['nprocs_instrument'], detector_nep=self.detector_nep, seed=seed)

ndet = wdet * Qubic150.detector_noise()
npho150 = wpho150 * Qubic150.photon_noise()
Expand All @@ -75,16 +77,18 @@ def total_noise(self, wdet, wpho150, wpho220):

class QubicDualBandNoise:

def __init__(self, d, npointings, detector_nep=4.7e-17):
def __init__(self, d, npointings, detector_nep=4.7e-17, seed=None):

self.d = d
self.npointings = npointings
self.detector_nep = detector_nep

def total_noise(self, wdet, wpho150, wpho220):
def total_noise(self, wdet, wpho150, wpho220, seed=None):

Qubic150 = QubicNoise(150, self.npointings, comm=self.d['comm'], size=self.d['nprocs_instrument'], detector_nep=self.detector_nep)
Qubic220 = QubicNoise(220, self.npointings, comm=self.d['comm'], size=self.d['nprocs_instrument'], detector_nep=self.detector_nep)
Qubic150 = QubicNoise(150, self.npointings, comm=self.d['comm'], size=self.d['nprocs_instrument'], detector_nep=self.detector_nep, seed=seed)
if seed is not None :
seed += 1
Qubic220 = QubicNoise(220, self.npointings, comm=self.d['comm'], size=self.d['nprocs_instrument'], detector_nep=self.detector_nep, seed=seed)

ndet150 = wdet * Qubic150.detector_noise().ravel()
ndet220 = wdet * Qubic220.detector_noise().ravel()
Expand Down
4 changes: 2 additions & 2 deletions mapmaking/systematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,12 @@ def __init__(self, d, Nsub, Nrec=1, comp=[], kind='Two', nu_co=None):
# for i in range(len(self.subacqs)):
# del(self.H[i].operands[-1])# = IdentityOperator()

#for i in range(len(self.multiinstrument)):
for i in range(len(self.multiinstrument)):
# #print(i)
# #self.Proj += [qubic.QubicAcquisition(self.multiinstrument[i], self.sampling, self.scene, self.d).get_projection_operator()]
# self.H += [qubic.QubicAcquisition(self.multiinstrument[i], self.sampling, self.scene, self.d).get_operator()]
# self.subacqs += [qubic.QubicAcquisition(self.multiinstrument[i], self.sampling, self.scene, self.d)]
# self.allfwhm[i] = self.multiinstrument[i].get_convolution_peak_operator().fwhm
self.allfwhm[i] = self.multiinstrument[i].get_convolution_peak_operator().fwhm


#if self.d['comm'] is not None:
Expand Down
Loading

0 comments on commit 7be87c4

Please sign in to comment.