#! /usr/bin/env python import sys import csv import matplotlib.pyplot as plt from matplotlib.mlab import griddata import numpy as np print "***********************************************************************************" print "** This script generates a quick plot with the csv file from OCLIMAX. **" print "** Usage: pclimax.py [-unit_tag] *.csv **" print "** -m : meV, -w : wavenumber (cm-1), -t : THz (default: unit in csv) **" print "***********************************************************************************" if sys.argv[1].startswith('-'): if sys.argv[1]=='-m': plt_unit = 'meV' elif sys.argv[1]=='-w': plt_unit = 'cm-1' elif sys.argv[1]=='-t': plt_unit = 'THz' else: print "-unit_tag not recognized" sys.exit() csvfile = sys.argv[2] else: csvfile = sys.argv[1] tab = list(csv.reader(open(csvfile,'r'))) INSTR = tab[2][1] dE_UNIT = tab[2][4] if int(dE_UNIT) == 0: csv_unit = 'cm-1' elif int(dE_UNIT) == 1: csv_unit = 'meV' elif int(dE_UNIT) == 2: csv_unit = 'THz' try: plt_unit except NameError: scale = 1.0 unit = csv_unit else: unit = plt_unit if plt_unit==csv_unit: scale = 1.0 elif plt_unit=='cm-1' and csv_unit=='meV': scale = 8.06554 elif plt_unit=='cm-1' and csv_unit=='THz': scale = 33.35641 elif plt_unit=='meV' and csv_unit=='cm-1': scale = 0.12399 elif plt_unit=='meV' and csv_unit=='THz': scale = 4.13567 elif plt_unit=='THz' and csv_unit=='cm-1': scale = 0.02998 elif plt_unit=='THz' and csv_unit=='meV': scale = 0.24180 i=0 while i