for k in sorted(gdat.keys()): dat = gdat[k]['data'] tofLock_cond = [ ('DIMPLELATTICE:tof', args.tofval),\ ('DIMPLELATTICE:imgdet', args.braggdet)] if not args.varyimage: tofLock_cond = tofLock_cond + [('DIMPLELATTICE:image', args.imageTOFlock)] inSitu_cond = [('DIMPLELATTICE:tof',0.0),('DIMPLELATTICE:imgdet',args.braggdet), ('DIMPLELATTICE:force_lcr3', -1) ] if not args.varyimage: inSitu_cond = inSitu_cond + [('DIMPLELATTICE:image',args.image)] tofLock = data_pick( dat, tofLock_cond , K ) inSitu = data_pick( dat, inSitu_cond, K ) print "LOCKTOF DATA @", np.unique(tofLock[:,K(args.xkey)]) print "INSITU DATA @", np.unique(inSitu[:,K(args.xkey)]) tofLockset = set( np.unique(tofLock[:,K(args.xkey)]).tolist() ) inSituset = set( np.unique(inSitu[:,K(args.xkey)]).tolist() ) common = list( tofLockset & inSituset ) print common np.set_printoptions(suppress=True, precision=3) for i,c in enumerate(sorted(common)): tofLocki = tofLock[ tofLock[:,K(args.xkey)] == c ] inSitui = inSitu[ inSitu[:,K(args.xkey)] == c ] for n,j in enumerate(inSitui): index, shot = min(enumerate(tofLocki[:,K("SEQ:shot")]),key=lambda l: abs(l[1]-j[K("SEQ:shot")])) ishot = "report%04d.INI" %j[K('SEQ:shot')]
tofLock_cond = [ ('DIMPLELATTICE:tof', args.tofval),\ ('DIMPLELATTICE:imgdet', args.braggdet)] if not args.varyimage: tofLock_cond = tofLock_cond + [('DIMPLELATTICE:image', args.imageTOFlock)] tofAssoc_cond = [ ('DIMPLELATTICE:tof', args.tofval),\ ('DIMPLELATTICE:imgdet', args.braggdet),\ ('DIMPLELATTICE:image', args.imageTOFassoc) ] inSitu_cond = [('DIMPLELATTICE:tof',0.0),('DIMPLELATTICE:imgdet',args.braggdet), ('DIMPLELATTICE:force_lcr3', -1) ] if not args.varyimage: inSitu_cond = inSitu_cond + [('DIMPLELATTICE:image',args.image)] tofLock = data_pick( dat, tofLock_cond , K ) tofAssoc = data_pick( dat, tofAssoc_cond, K ) inSitu = data_pick( dat, inSitu_cond, K ) print "LOCKTOF DATA @", np.unique(tofLock[:,K(args.xkey)]) print "ASSOCTOF DATA @", np.unique(tofAssoc[:,K(args.xkey)]) print "INSITU DATA @", np.unique(inSitu[:,K(args.xkey)]) # PLOT ALL THE tofLock DATA tofLock_label = '$10\,\mu\mathrm{s}$ TOF' tofLock_offset = -0.4 tofLock_color = 'black' plotkey( ax1, gdat[k], K, fx, args.xkey, 'HHHEIGEN:andor2norm', tofLock, base1, \ marker='s', mec=tofLock_color, mfc='None', ms=4.,\ labelstr=tofLock_label,\ save=False, raw=True, raw_offset=tofLock_offset)