def analyze_path( shot , args):

  atoms, noatoms = importfits(shot)
  out = atoms-noatoms
  
  shotnum = '%04d' % int(shot)
 
  if args.stats:
    analyze_stats( out, args.stats) 

  try:
    CX = float(args.c.split(',')[0])   
    CY = float(args.c.split(',')[1])   
    args.Ccts = out[CY,CX]
    hs = args.size / 2
    off = 0 
    out = out[ CY-hs-off:CY+hs-off, CX-hs-off:CX+hs-off ]
    args.X0 = CX-hs-off
    args.Y0 = CY-hs-off
    args.CX = CX
    args.CY = CY
  except:
    print "...Could not crop to specified center and size"
    print "...  c = (%s),  size = %d" % (args.c, args.size)
    exit(1)

  #All cropped data is saved in the data dir for averaging use
  numpy.savetxt(shot+'_bragg.dat', out, fmt='%d')

  #Results
  center = (CX,CY)
  inifile = "report" + shotnum + ".INI"
  report = ConfigObj(inifile)
  report['BRAGG'] = {}
  for boxsize in (2. ,4., 6., 8.):
    r = get_counts(out, args, boxsize) 
    for key in r.keys():
        report['BRAGG'][key] = r[key]
    report.write()

  if not os.path.exists(args.path):
    os.makedirs(args.path)
 
  pngprefix = args.path + shotnum + '_bragg' 
  falsecolor.inspecpng( [out], \
                        r['row'], r['col'], out.min(), out.max(), \
                        falsecolor.my_grayscale, \
                        pngprefix, 100, origin = 'lower' , \
                        step=True, scale=10, \
                        interpolation='nearest', \
                        extratext='')

  
  return
#!/usr/bin/python

import sys
from numpy import loadtxt
import falsecolor


if __name__ == "__main__":
   # This program should be called as 
   # inspect2d_ascii.py  data.ascii fit.ascii inspec_row inspec_col  prefix
   data = loadtxt(sys.argv[1])
   fit  = loadtxt(sys.argv[2])

   row = sys.argv[3]
   col = sys.argv[4]

   prefix = sys.argv[5]

   falsecolor.inspecpng( [data, fit], row, col, data.min(), data.max(), \
                         falsecolor.my_rainbow, prefix, 100, origin = 'lower' ) 
  
   
   
 
import sys
from numpy import loadtxt
import falsecolor
from matplotlib import cm


if __name__ == "__main__":
   # This program should be called as 
   # inspect2d_ascii.py  data.ascii,fit1.ascii,fit2.ascii,fit3.ascii,... inspec_row inspec_col  prefix
   list = sys.argv[1].split(',')
   imgs =[]
   for file in list:
      imgs.append( loadtxt (file) )
     

   row = sys.argv[2]
   col = sys.argv[3]

   prefix = sys.argv[4]

   #colormap = falsecolor.my_rainbow
   colormap = cm.spectral

   falsecolor.inspecpng( imgs, row, col, imgs[0].min(), imgs[0].max(), \
                         colormap, prefix+'_multi', 100, origin = 'upper' ) 
  
   
   
 
#!/usr/bin/python

import sys
from numpy import loadtxt
import falsecolor
from matplotlib import cm

if __name__ == "__main__":
    # This program should be called as
    # inspect2d_ascii.py  data.ascii fit.ascii inspec_row inspec_col  prefix
    data = loadtxt(sys.argv[1])
    fit = loadtxt(sys.argv[2])

    row = sys.argv[3]
    col = sys.argv[4]

    prefix = sys.argv[5]

    #colormap = falsecolor.my_rainbow
    colormap = cm.spectral


    falsecolor.inspecpng( [data, fit], row, col, data.min(), data.max(), \
                          colormap, prefix, 100, origin = 'lower' )
#!/usr/bin/python

import sys
from numpy import loadtxt
import falsecolor
from matplotlib import cm

if __name__ == "__main__":
    # This program should be called as
    # inspect2d_ascii.py  data.ascii,fit1.ascii,fit2.ascii,fit3.ascii,... inspec_row inspec_col  prefix
    list = sys.argv[1].split(',')
    imgs = []
    for file in list:
        imgs.append(loadtxt(file))

    row = sys.argv[2]
    col = sys.argv[3]

    prefix = sys.argv[4]

    #colormap = falsecolor.my_rainbow
    colormap = cm.spectral

    falsecolor.inspecpng( imgs, row, col, imgs[0].min(), imgs[0].max(), \
                          colormap, prefix+'_multi', 100, origin = 'upper' )
Example #6
0
def analyze_path( mantapath , args):
  shotnum =  os.path.basename( mantapath ).split('atoms.manta')[0]
  shotnum = "%04d" % int(shotnum)
  print "\n%s" % shotnum,

  atomsfile = shotnum + 'atoms.manta'


  shot = atomsfile.split('atoms')[0]
  atoms     = numpy.loadtxt( shot + 'atoms.manta')
  noatoms   = numpy.loadtxt( shot + 'noatoms.manta')
  #atomsref  = numpy.loadtxt( shot + 'atomsref.manta')
  #noatomsref= numpy.loadtxt( shot + 'noatomsref.manta')

  operation = 'PHC' 
  try: 
     if operation == 'ABS':
       out = (atoms - atomsref) / (noatoms - noatomsref)
     elif operation == 'PHC':
       out = atoms - noatoms
       #out = (atoms - atomsref) - (noatoms - noatomsref) 
     else:
       print " -->  Operation is not ABS or PHC.  Program will exit"
       exit(1) 
  except:
     print "...ERROR performing background and reference subtraction"
     return
  
  try:
    CX = float(args.c.split(',')[0])   
    CY = float(args.c.split(',')[1])   
    args.Ccts = out[CY,CX]
    hs = args.size / 2
    off = 0 
    out = out[ CY-hs-off:CY+hs-off, CX-hs-off:CX+hs-off ]
    args.X0 = CX-hs-off
    args.Y0 = CY-hs-off
    args.CX = CX
    args.CY = CY
  except:
    print "...Could not crop to specified center and size"
    print "...  c = (%s),  size = %d" % (args.c, args.size)
    exit(1)

  #All cropped data is saved in the data dir for averaging use
  numpy.savetxt(shot+'_bragg.dat', out, fmt='%d')

  #Results
  center = (CX,CY)
  inifile = "report" + shotnum + ".INI"
  report = ConfigObj(inifile)
  report['BRAGG'] = {}
  for boxsize in (2. ,4., 6., 8.):
    r = get_counts(out, args, boxsize) 
    for key in r.keys():
        report['BRAGG'][key] = r[key]
    report.write()

  if not os.path.exists(args.path):
    os.makedirs(args.path)
 
  pngprefix = args.path + shotnum + '_bragg' 
  falsecolor.inspecpng( [out], \
                        r['row'], r['col'], out.min(), out.max(), \
                        falsecolor.my_grayscale, \
                        pngprefix, 100, origin = 'upper' , \
                        step=True, scale=10, \
                        interpolation='nearest', \
                        extratext='')

  
  return
#!/usr/bin/python

import sys
from numpy import loadtxt
import falsecolor
from matplotlib import cm


if __name__ == "__main__":
    # This program should be called as
    # inspect2d_ascii.py  data.ascii fit.ascii inspec_row inspec_col  prefix
    data = loadtxt(sys.argv[1])
    fit = loadtxt(sys.argv[2])

    row = sys.argv[3]
    col = sys.argv[4]

    prefix = sys.argv[5]

    # colormap = falsecolor.my_rainbow
    colormap = cm.spectral

    falsecolor.inspecpng([data, fit], row, col, data.min(), data.max(), colormap, prefix, 100, origin="lower")