Ejemplo n.º 1
0
def createPpmFreqDataSource(exp,dsName,dsType,numDim):

  ds = Nmr.DataSource(exp,name = dsName, numDim = numDim, dataType = dsType)

  for dim in range(0,numDim):
    expDim = exp.findFirstExpDim(dim = (dim + 1))
    expDimRefs = expDim.sortedExpDimRefs()
    refIsotopeCode = expDimRefs[0].isotopeCodes[0]
    
    # User first expDimRef to set number of points
    # Set numPoints, numPointsOrig to 20 for H, 250 for C,N!
    if refIsotopeCode == '1H':
      numPoints = 1024
      valuePerPoint = 6.5
    else:
      numPoints = 256
      if refIsotopeCode == '13C':
        valuePerPoint = 100.0
      elif refIsotopeCode== '15N':
        valuePerPoint = 40.0
      else:
        valuePerPoint = 1.0

    # Setting up empty freqdatadim and associated datadimref...
    # Assuming that imaginary data will be deleted!
    freqDataDim = Nmr.FreqDataDim(ds, expDim = expDim, dim = (dim + 1), isComplex = True,valuePerPoint = valuePerPoint, numPoints = numPoints, numPointsOrig = numPoints)
      
    # Tag to mark that this is a 'default' freqDataDim
    freqDataDim.addApplicationData(Implementation.AppDataBoolean(application = ccpNmr_kw, keyword = 'default', value = True))
  
  # Set sensible dataDimRef info.
  setDataDimRefs(ds)

  return ds
Ejemplo n.º 2
0
def tagAsFresh(ccpnObject):

  appData = ccpnObject.findFirstApplicationData(keyword = freshTag)
  
  if not appData:
    appData = Implementation.AppDataBoolean(application = 'pdbeCcGeneration', keyword = freshTag, value = True)
    ccpnObject.addApplicationData(appData)
  
  appData.value = True
Ejemplo n.º 3
0
    def tagAriaInput(self, object):

        appData = object.findFirstApplicationData(application=ccpNmr_kw,
                                                  keyword=isAriaInput_kw)

        if not appData:
            object.addApplicationData(
                Implementation.AppDataBoolean(application=ccpNmr_kw,
                                              keyword=isAriaInput_kw,
                                              value=True))
Ejemplo n.º 4
0
def createExperiment(proj,expName,refExperiment,unit = 'ppm'):
  
  #
  # Create a default experiment based on a reference experiment... 
  #

  numDim = len(refExperiment.refExpDims)
  isReversed = refExperiment.isReversed
  
  # Make sure experiment name fits Ccp Line
  expName = returnMemopsLine(expName)

  # Create the experiment
  exp = Nmr.Experiment(proj.currentNmrProject,name = expName, numDim = numDim, refExperiment = refExperiment)
  
  # Tag to mark that this is a 'default' experiment
  exp.addApplicationData(Implementation.AppDataBoolean(application = ccpNmr_kw, keyword = 'default', value = True))

  #
  # Set expDimRefs
  #
  
  atomSiteList = []
  acquisitionDim = None
  
  for i in range(0,numDim):
  
    expDim = exp.findFirstExpDim(dim = i + 1)
   
    refExpDim = refExperiment.findFirstRefExpDim(dim = i + 1)
    expDim.refExpDim = refExpDim

    atomSiteList.append([])

    for refExpDimRef in refExpDim.refExpDimRefs:

      # TODO Here catch things like ConstantTimePeriod for editing!!!!?!?!
      
      expMeasurement = refExpDimRef.expMeasurement
      
      isotopeCodes = []
      for atomSite in expMeasurement.atomSites:
        isotopeCodes.append(atomSite.isotopeCode)

      if isotopeCodes.count('1H'):
        sf = baseFrequency = 500.0
      elif isotopeCodes.count('13C'):
        sf = baseFrequency = 125.7367377
      elif isotopeCodes.count('15N'):
        sf = baseFrequency = 50.670637
      else:
        sf = baseFrequency = 1.0
        
      #
      # Setting paramaters correctly goes via GUI interface... these are 'defaults'
      #

      expDimRef = Nmr.ExpDimRef(expDim, unit = unit,
                                        sf = sf,
                                        baseFrequency = baseFrequency,
                                        measurementType = expMeasurement.measurementType,
                                        isotopeCodes = isotopeCodes,
                                        refExpDimRef = refExpDimRef)

      # Tag to mark that this is a 'default' expDimRef
      expDimRef.addApplicationData(Implementation.AppDataBoolean(application = ccpNmr_kw, keyword = 'default', value = True))

      #
      # Keep track for expTransfer settings...
      #
      
      atomSiteList[-1].append((expDimRef,expMeasurement.atomSites))

  #
  # Set acquisition dimension. Is the expMeasurement connected to the last
  # expStep (or first expStep in case isReversed).
  #
  
  expDim = None
  
  for expGraph in refExperiment.nmrExpPrototype.expGraphs:

    expStepNums = []
    for expStep in expGraph.expSteps:
      expStepNums.append(expStep.stepNumber)
    expStepNums.sort()

    if not isReversed:
      expStepNums.reverse()
    
    for expStepNum in expStepNums:
      expStep = expGraph.findFirstExpStep(stepNumber = expStepNum)

      for refExpDimRef in expStep.expMeasurement.refExpDimRefs:
         
        refExpDim = refExpDimRef.refExpDim
        expDim = exp.findFirstExpDim(refExpDim = refExpDim)

        if expDim:
          break
      
      if expDim:
        break
    
    if expDim:
      break
  
  if expDim:  
    expDim.isAcquisition = True
    
  #
  # Set expTransfers...
  #
  
  for i in range(0,len(atomSiteList)-1):

    for (expDimRef,atomSites) in atomSiteList[i]:
      for otherAtomSiteList in atomSiteList[i+1:]:
        for (otherExpDimRef,otherAtomSites) in otherAtomSiteList:
          for expGraph in atomSites[0].nmrExpPrototype.expGraphs:

            #
            # Transfers are only set in simple case: direct transfer between single atomSites corresponding to expDimRefs
            #

            expDimRefSet = set([expDimRef,otherExpDimRef])
            
            sites = frozenset([atomSites[0],otherAtomSites[0]])
            refExpTransfer = expGraph.findFirstExpTransfer(atomSites = sites)

            if refExpTransfer:
              expTransfer = exp.findFirstExpTransfer(transferType = refExpTransfer.transferType, expDimRefs = expDimRefSet)
              if not expTransfer:
                expTransfer = exp.newExpTransfer(transferType = refExpTransfer.transferType, expDimRefs = expDimRefSet)        

  return exp