Beispiel #1
0
 def get_filename(self):
     # check if we are looking at abspath or not
     if self._abspath:
         return self._tod_name
     else:
         # check if filebase is setup
         if self._fb:
             return self._fb.filename_from_name(self.get_name(),
                                                single=True)
         else:
             from moby2.scripting import get_filebase
             self._fb = get_filebase()
             return self._fb.filename_from_name(self.get_name(),
                                                single=True)
Beispiel #2
0
def todFlats(basename):

    lib = cdll.LoadLibrary("./flatFull.so")
    fltmod = lib.flats

    fltmod.argtypes = [ctypes.c_int, ctypes.c_void_p]
    fltmod.restypes = ctypes.c_double

    fb = get_filebase()

    filename = fb.filename_from_name(basename, single=True)

    tod = moby2.scripting.get_tod({'filename': filename})

    len = int(np.shape(tod.data)[1])
    loop = 1
    print("length of tod = ", len)
    med = np.zeros(len)
    delta = np.zeros(len)
    # find mean value;  normalize tod values to the mean.
    n_dets = int(np.shape(tod.data)[0])
    print("number of detectors = {}\n".format(n_dets))
    loop = 1
    pct_flats = 0.0
    flat_count = {}
    bad_list = []
    while loop < n_dets:
        detector = loop
        data = tod.data[detector]
        arr = (ctypes.c_double * len)(*data)
        flat_count[detector] = fltmod(len, arr)
        pct_flats = 100.0 * flat_count[detector] / len
        if (pct_flats > 40.0): bad_list.append(detector)
        loop += 1

    print("\n\nBad Detectors by the flats algorithm \n\n")
    print("{}".format(bad_list))

    return bad_list
Beispiel #3
0
 def initialize(self):
     self._fb = get_filebase()
Beispiel #4
0
import moby2
from moby2.instruments import actpol
from moby2.scripting import get_filebase
import matplotlib
matplotlib.use('GTKAgg')  # This is necessary to show plots over ssh
import matplotlib.pyplot as plt

# Initialization
db = actpol.TODDatabase()
ids = db.select_tods()
fb = get_filebase()

# Selection
#TOD = 117
TOD = 8162

# Plot TOD
tod = ids[TOD]
tod_name = tod.basename
tod_dir = fb.filename_from_name(tod_name, single=True)

data = moby2.scripting.get_tod({'filename': tod_dir, 'repair_pointing': True})
for i in range(len(data.data)):
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(data.ctime[10000:11000], data.data[i][10000:11000])
    fig.savefig('outputs/plot_tod/' + str(i) + '.png')
'''
# Plot cuts together with TOD
glitchp ={ 'nSig': 10, 'tGlitch' : 0.007, 'minSeparation': 30, 'maxGlitch': 50000, 'highPassFc': 6.0, 'buffer': 0 }