# 2: all memeber curves with comparison
# 3: all memeber curves with Diff
keyword = '' #'EJ200SP-1P-N1' #'1X1P N1'						# read sample
#keyword2 = '1X1P N6'						# read sample
s = Curve.makeslice(300,600)		# x-range (band of wavelength in nm)
t = True					# transmission or absorption curve; None for absorption
newdate = True


dateN2 = date(2015,12,19)
dateN3 = date(2016,01,14)
dateN4 = date(2016,01,11)
if newdate:
	dateN4 = date(2016,03,25)
dateCT = date(2015,11,3) # inaccurate

allc = curvesKeyword(allcurves, name = keyword) 
#allc2 = curvesKeyword(allcurves, name = keyword2)
#allc += allc2
#allc = curveCreation(date.today(), ['data/EJ_20160328_air_SPN4.csv'], verbose = 1)


print 'Drawing curves ...\n'
for c in allc:
	[c.plot,c.plotallcurves,c.plotallcurvesComp,c.plotallcurvesDiff][mode](t=t,
		ratioyrange=[-0.06,0.06],save = False, plotting = True, s = s)




Example #2
0
#allctemp = curveCreation(date(2016,10,21), ['data/EJ_20161021-air_calib.csv'], verbose = 1,skips=2)
#curveCreation(date(2016,10,18),
#		['data/EJ_10-18-2016-air_calib.csv'], verbose = 1,skips=2)

if False:

    def avg_gen(c):
        # local shorthand
        # *** Special: to cancel out effect of higher attenuation on C side ***
        nonzero = c.arraynzd()[(0, 1, 3), :]
        temp = np.average(c.trsm(nonzero), 0)[s]
        return temp


keyword = refkeyword = sys.argv[1]  #'EJ200SP-1P-N1'
allcurves = curvesKeyword(allctemp, name=keyword)
refcurves = curvesKeyword(refctemp, name=keyword)
print[c.len() for c in allcurves]
print[c.len() for c in refcurves]
print allcurves
print refcurves
cnum, refnum = 0, 1
s = Curve.makeslice(350, 600)
ratioyrange = [-0.06, 0.06]

c_int = allcurves[cnum]
cref = refcurves[refnum]
fig, (ax1, ax2) = pyt.subplots(2,
                               1,
                               sharex=True,
                               gridspec_kw=shr,
farben = ['blue', 'green', 'red' , 'blueviolet','slategray','darkcyan','magenta']
farben += ['hotpink', 'salmon','springgreen','chocolate', 'crimson']

#pyt.figure(figsize = (8,5))
x= np.linspace(600,200,401)
s = Curve.makeslice(350,550)		#slice(None) # x-range (band of wavelength in nm)
t = True
refnum = 0
daysIrr = 7
coldwarm = True
legFont = 13

# plot all curves of material A and day of irradaition D
keyword = '200-1X'
ckeyword = curvesKeyword(curves, char = '-', name = keyword)
allc = curvesAge(ckeyword, day = daysIrr, rincl = False, dayrange = 1)
cref = curvesRef(ckeyword, rred=False) 
print cref
#specPlotter(c1, 'EJ260-1X1P on day 24', xlabel='wavelength nm', ylabel='transmission', trsm=1)
batchDes = ['', ' UnIrr.', 'N2 @3Mrad', 'N3 @3Mrad High Rate', 'N4 @3Mrad $N_{2}$', 'CastorT'] 
if coldwarm:
	batchDes = ['', ' UnIrr.']+ [0]*7 +[' UnIrr.', r'23$^{\circ}$C', r'-30$^{\circ}$C'] 


fig, (ax1, ax2) = pyt.subplots(2,1, sharex=True, gridspec_kw=dict(height_ratios = [3,2]),figsize = (8,8))
tLabel = ' Transmission' if t is not None else ' Absorption'
fig.suptitle('EJ'+ keyword+ tLabel +' Spectrum', y=.95, size=17)
iterfarb = iter(farben)
ax1.plot(x[s],cref[refnum].avgcurve(t=t)[s], label = 'Unirradiated ',
			 color = iterfarb.next())
## to compare with past refs

## version new: rearranged and merged the curve and ratio plotting procedures

# july 9th: check readCurveSequence for similar capability

import numpy as np
import matplotlib.pyplot as pyt
from datetime import date
import sys
from Curve import (Curve, curvesKeyword, curveCreation, keycGen, specPlotter,
                   curvesAge, curvesRef, readCurveFile)

execfile('readCurveInput_default.py')  # loads default setting
execfile('readCurveInput_260PVTDiff.py')
allc = curvesKeyword(allcurves, name=keyword)
allc2 = curvesKeyword(allcurves, name=keyword2)
refc = curvesKeyword(refcurves, name=refkeyword)
cref = refc[refnum]

fig, (ax1, ax2) = pyt.subplots(2,
                               1,
                               sharex=True,
                               gridspec_kw=shr,
                               figsize=(8, 8))

## TITLES and labels
fig.suptitle(eval(titleGen), y=.95, size=17)
iterfarb, iterfarb2 = iter(farben), iter(farben2)

# DRAW REFERENCE AND ERROR
import matplotlib.pyplot as pyt
from datetime import date
import sys
from Curve import (Curve, curvesKeyword, curveCreation, keycGen, specPlotter,
                   curvesAge, curvesRef, readCurveFile)

execfile('readCurveInput_default.py')  # loads default setting

allcurves = curveCreation(date(2016, 7, 8), ['data/EJ_20160708_air_test.csv'],
                          verbose=1,
                          skips=3,
                          sepcurve=True)
# separate curves are inputed

## selects only EJ260-1X1P... also only the a side measurements
allcurves = curvesKeyword(allcurves, name='EJ260-1X1P')[:27]
allcurves = [c for c in allcurves if c.view(1) is not 0]
cref = sum(allcurves[4:15])

farbGruppe = [[
    'blue', 'darkblue', 'darkslateblue', 'royalblue', 'steelblue', 'darkcyan'
], ['red', 'darkred', 'crimson', 'orangered', 'salmon'
    ], ['green', 'darkgreen', 'olive', 'darkturquoise', 'greenyellow', 'sage'],
              ['magenta', 'blueviolet', 'purple', 'darkmagenta', 'darkviolet'],
              ['slategray', 'dimgrey']]
farben = ['blue'] + farbGruppe[1][:3] + farbGruppe[3][:4]

## Parameters
s = Curve.makeslice(350, 600)  ##x-range (band of wavelength in nm)
shr = dict(height_ratios=[2, 3])  #subplot height ratio
figsize = (8, 9)  #(8,8)