Пример #1
0
 def __init__(self, f):
     self.config = list()
     import shlex
     thisf = open(f)
     try:
         for line in thisf:
             if not line.startswith("--") and not line.startswith("#"):
                 parts = shlex.split(line)
                 if len(parts) == 4:
                     # single pixel to be masked:
                     p = PixelConfig(int(parts[2]),int(parts[3]),15)
                     p.roc = int(parts[1])
                     p.mask = True
                     self.config.append(p)
                 elif len(parts) == 3:
                     # Full Column/Row to be masked:
                     if parts[0] == "col":
                         for row in range(0, 80):
                             p = PixelConfig(int(parts[2]),row,15)
                             p.roc = int(parts[1])
                             p.mask = True
                             self.config.append(p)
                     elif parts[0] == "row":
                         for column in range(0, 52):
                             p = PixelConfig(column,int(parts[2]),15)
                             p.roc = int(parts[1])
                             p.mask = True
                             self.config.append(p)
                 elif len(parts) == 2:
                     # Full ROC to be masked
                     for column in range(0, 52):
                         for row in range(0, 80):
                             p = PixelConfig(column,row,15)
                             p.roc = int(parts[1])
                             p.mask = True
                             self.config.append(p)
     finally:
         thisf.close()
Пример #2
0
 def __init__(self, f):
     self.config = list()
     import shlex
     thisf = open(f)
     try:
         for line in thisf:
             if not line.startswith("--") and not line.startswith("#"):
                 parts = shlex.split(line)
                 if len(parts) == 4:
                     # single pixel to be masked:
                     p = PixelConfig(int(parts[2]), int(parts[3]), 15)
                     p.roc = int(parts[1])
                     p.mask = True
                     self.config.append(p)
                 elif len(parts) == 3:
                     # Full Column/Row to be masked:
                     if parts[0] == "col":
                         for row in range(0, 80):
                             p = PixelConfig(int(parts[2]), row, 15)
                             p.roc = int(parts[1])
                             p.mask = True
                             self.config.append(p)
                     elif parts[0] == "row":
                         for column in range(0, 52):
                             p = PixelConfig(column, int(parts[2]), 15)
                             p.roc = int(parts[1])
                             p.mask = True
                             self.config.append(p)
                 elif len(parts) == 2:
                     # Full ROC to be masked
                     for column in range(0, 52):
                         for row in range(0, 80):
                             p = PixelConfig(column, row, 15)
                             p.roc = int(parts[1])
                             p.mask = True
                             self.config.append(p)
     finally:
         thisf.close()
Пример #3
0
 def __init__(self, f, roc, masks):
     self.config = list()
     thisf = open(f)
     try:
         for line in thisf:
             if not line.startswith("--") and not line.startswith("#"):
                 parts = shlex.split(line)
                 if len(parts) == 4:
                     # Ignore the 'Pix' string in the file...
                     p = PixelConfig(int(parts[2]),int(parts[3]),int(parts[0]))
                     p.roc = roc
                     # Check if this pixel is masked:
                     if p in masks:
                         p.mask = True
                     else:
                         p.mask = False
                     self.config.append(p)
     finally:
         thisf.close()
Пример #4
0
 def __init__(self, f, roc, masks):
     self.config = list()
     thisf = open(f)
     try:
         for line in thisf:
             if not line.startswith("--") and not line.startswith("#"):
                 parts = shlex.split(line)
                 if len(parts) == 4:
                     # Ignore the 'Pix' string in the file...
                     p = PixelConfig(int(parts[2]), int(parts[3]),
                                     int(parts[0]))
                     p.roc = roc
                     # Check if this pixel is masked:
                     if p in masks:
                         p.mask = True
                     else:
                         p.mask = False
                     self.config.append(p)
     finally:
         thisf.close()