QuantumQuadrate / CsPyController

GNU Lesser General Public License v3.0
3 stars 3 forks source link

TTL filter "good" and "bad" condition #21

Open kwnminho opened 6 years ago

kwnminho commented 6 years ago

Actual code appears to consider TTL LO as good measurements and HI as bad ones, as shown below.

`class TTL_filters(Analysis): """This analysis monitors the TTL inputs and does either hard or soft cuts of the data accordingly. Low is good, high is bad."""

text = Str()
filter_level = Int()

def __init__(self, name, experiment, description=''):
    super(TTL_filters, self).__init__(name, experiment, description)
    self.properties += ['text', 'filter_level']

def analyzeMeasurement(self, measurementResults, iterationResults, experimentResults):
    text = 'none'
    if 'TTL/data' in measurementResults['data']:
        a = measurementResults['data/TTL/data']
        #check to see if any of the inputs were True
        if numpy.any(a):
            #report the true inputs
            text = 'TTL Filters failed:\n'
            for i,b in enumerate(a):
                #print out the row and column of the True input
                text += 'Check {}: Laser(s) {}\n'.format(i, numpy.arange(len(b))[b])
            #record to the log and screen
            logger.warning(text)
            self.set_gui({'text': text})
            self.experiment.set_gui({'valid': False})
            if self.experiment.enable_sounds:
                sound.warning_sound()

            # User chooses whether or not to delete data.
            # max takes care of ComboBox returning -1 for no selection
            return max(0, self.filter_level)
        else:
            text = 'okay'
    self.set_gui({'text': text})`

However in CsPyController User manual, it says the other way. (LO as bad ones)

image

Users have to be clear about what they want, and make necessary changes.