def __init__(self): self.idealOverlapsPath = Path('input') / Path( 'detectorOverlapsIdeal.json') self.idealOverlapInfos = mi.loadMatrices(self.idealOverlapsPath, False) self.idealDetectorMatrixPath = Path('input') / Path( 'detectorMatricesIdeal.json') self.idealDetectorMatrices = mi.loadMatrices( self.idealDetectorMatrixPath) self.availableOverlapIDs = self.getOverlapsFromJSON() self.overlapMatrices = {} self.alignmentMatrices = {} self.maxPairs = 6e5 self.dCut = 1.0 # dictionary overlapID: matrix self.lock = Lock()
def combineAlignmentMatrices(self): if self.externalMatrices == None: raise Exception('Error! Please set externally measured matrices!') # these are important! the combiner MUST only get the overlap matrices sortedMatrices = collections.defaultdict(dict) sortedOverlaps = collections.defaultdict(dict) if len(self.overlapMatrices) < 360: raise Exception(f'Error! Not all overlap matrices could be found!') # sort overlap matrices by module they are on for overlapID in self.availableOverlapIDs: modulePath = self.idealOverlapInfos[overlapID]['pathModule'] sortedMatrices[modulePath].update( {overlapID: self.overlapMatrices[overlapID]}) print(f'found {len(sortedMatrices)}, modules, should be 40.') # sort overlapInfos to dict by module path for modulePath in sortedMatrices: for overlapID in self.idealOverlapInfos: if self.idealOverlapInfos[overlapID][ 'pathModule'] == modulePath: sortedOverlaps[modulePath].update( {overlapID: self.idealOverlapInfos[overlapID]}) idealMatrices = mi.loadMatrices(self.idealDetectorMatrixPath) for modulePath in sortedMatrices: combiner = alignmentMatrixCombiner(modulePath) combiner.setIdealDetectorMatrices(idealMatrices) combiner.setOverlapMatrices(sortedMatrices[modulePath]) combiner.setExternallyMeasuredMatrices(self.externalMatrices) combiner.combineMatrices() resultMatrices = combiner.getAlignmentMatrices() self.alignmentMatrices.update(resultMatrices) print( f'combined for all sensors on all modules. length: {len(self.alignmentMatrices)}' )
def loadExternalMatrices(self, fileName): self.externalMatrices = mi.loadMatrices(fileName)
def __init__(self): self.logger = None self.idealDetectorMatrixPath = Path('input') / Path('detectorMatricesIdeal.json') self.idealDetectorMatrices = mi.loadMatrices(self.idealDetectorMatrixPath)
def readAnchorPoints(self, fileName): self.anchorPoints = mi.loadMatrices(fileName, False)
def readAverageMisalignments(self, fileName): self.avgMisalignments = mi.loadMatrices(fileName)
def loadAlignerMatrices(self, filename): print(f'loading align matrices from:\n{filename}') self.alignerResults = mi.loadMatrices(filename)
def loadDesignMisalignments(self, filename): print(f'loading design misalignments from:\n{filename}') self.misalignMatrices = mi.loadMatrices(filename)
def loadIdealDetectorMatrices(self, filename): print(f'loading ideal detector matrices from:\n{filename}') self.idealDetectorMatrices = mi.loadMatrices(filename)
def loadSensorAlignerOverlapMatrices(self, filename): self.overlapMatrices = mi.loadMatrices(filename)
def loadPerfectDetectorOverlaps(self, fileName): self.overlaps = mi.loadMatrices(fileName, False)