示例#1
0
    def addDataSession(self,
                       slacNum,
                       container,
                       refGradVal=None,
                       calibSession=None):
        # type: (int, Cavity, float, CalibDataSession) -> Q0DataSession

        indices = self.idxMap[slacNum]

        fileReader, rows = self.getRowsAndFileReader(slacNum)

        # Unclear if this is actually necessary, but the idea is to have the
        # output of json.dumps be ordered by index number
        options = OrderedDict()

        for row in fileReader:

            # We could theoretically have hundreds of results, and that seems
            # like a seriously unnecessary number of options to show. This
            # asks the user if they want to keep searching for more every 10
            # hits
            if (len(options) + 1) % 10 == 0:
                printOptions(options)
                showMore = isYes("Search for more options? ")
                if not showMore:
                    break

            grad = float(row[indices["gradIdx"]])
            cavNum = int(row[indices["cavNumIdx"]])

            # The files are per cryomodule, so there's a lot of different
            # cavities in the file. We check to make sure that we're only
            # presenting the options for the requested cavity at the requested
            # gradient (by just skipping the irrelevant ones)
            if (grad != refGradVal) or (cavNum != container.cavNum):
                continue

            addOption(csvRow=row,
                      lineNum=fileReader.line_num,
                      indices=indices,
                      options=options)

        selection = getSelection(duration=2,
                                 suffix="Q0 Measurement",
                                 options=options)

        # If using an existing data session
        if selection != max(options):
            selectedRow = compatibleNext(reader([rows[selection - 1]]))
            refHeatLoad = float(selectedRow[indices["refHeatIdx"]])
            refHeatLoadAct = float(selectedRow[indices["refHeatActIdx"]])
            return container.addDataSessionFromRow(selectedRow, indices,
                                                   refHeatLoad, refHeatLoadAct,
                                                   calibSession, refGradVal)

        else:
            (Q0Sess, self.parent.valveParams) = container.runQ0Meas(
                refGradVal, calibSession, self.valveParams)
            return Q0Sess
    def addDataSession(self,
                       slacNum,
                       container,
                       refGradVal=None,
                       calibSession=None):
        # type: (int, Cryomodule, float, CalibDataSession) -> CalibDataSession

        indices = self.idxMap[slacNum]

        fileReader, rows = self.getRowsAndFileReader(slacNum, kind="calib")

        # Unclear if this is actually necessary, but the idea is to have the
        # output of json.dumps be ordered by index number
        options = OrderedDict()

        for row in fileReader:
            # if (len(options) + 1) % 10 == 0:
            #     printOptions(options)
            #     showMore = isYes("Search for more options? ")
            #     if not showMore:
            #         break

            addOption(csvRow=row,
                      lineNum=fileReader.line_num,
                      indices=indices,
                      options=options)

        selection = getSelection(duration=5,
                                 suffix="calibration",
                                 options=options)

        if selection != max(options):

            calibRow = compatibleNext(reader([rows[selection - 1]]))

            if not container:
                container = Cryomodule(slacNum,
                                       calibRow[indices["jlabNumIdx"]])

            refHeatLoad = float(calibRow[indices["refHeatIdx"]])
            refHeatLoadAct = float(calibRow[indices["refHeatActIdx"]])

            return container.addDataSessionFromRow(calibRow,
                                                   indices,
                                                   refHeatLoad,
                                                   refHeatLoadAct,
                                                   kind="calib")

        else:
            if not container:
                container = Cryomodule(
                    slacNum,
                    getNumInputFromLst("JLab cryomodule"
                                       " number: ", [2, 3], int))

            (calibSession, self.parent.valveParams) = container.runCalibration(
                self.parent.valveParams)

            return calibSession
示例#3
0
def getExportForTransforms(gltfContext):
    logger = logging.getLogger(__name__)

    transforms = []
    for n in utils.getSelection():
        if n.hasFn(OpenMaya.MFn.kTransform):
            transforms.append(n)

    result = []
    getGLTFNodes(gltfContext, transforms, result)

    gltfContext.nodes = result