from rsfproj import *
try:
import numpy as np
except:
raise Exception('Cannot find numpy')
import os
matlab = WhereIs('matlab')
if not matlab:
raise Exception('Cannot find Matlab')
matROOT = '../matfcts'
def mygrey(title,label1="Time",label2="Offset",unit1="s",unit2="m"):
return '''
sfgrey title="%s" minval=-.5 maxval=.5 clip=.2 crowd1=.5 crowd2=.75
label1="%s" unit1="%s" label2="%s" unit2="%s" parallel2=n
'''%(title,label1,unit1,label2,unit2)
min1 = 0
max1 = 4e3
min2 = -1
max2 = 110
maxiters = 100
FTPserver = {
'server': 'slim.eos.ubc.ca',
'login':'anonymous',
'password':'ghennenfent@eos.ubc.ca'}
loc = '/users/hegilles/papers/spsolvers/geop/'
fname = 'paretocurve.mat'
Fetch(fname,loc,FTPserver)
matfun = 'BuildPareto'
Flow('pxnorms prnorms pbxnorms pbrnorms pixnorms pirnorms',['./'+fname,os.path.join(matROOT,matfun+'.m')],
matlab + '''
-nosplash -nojvm -r "addpath %(matROOT)s;%(matfun)s('$SOURCE','$TARGET','${TARGETS[1]}','${TARGETS[2]}','${TARGETS[3]}','${TARGETS[4]}','${TARGETS[5]}');quit"
'''%vars(),stdin=0,stdout=-1)
Flow('ppath','pxnorms prnorms','sfcmplx ${SOURCES[:-1]}',stdin=0)
Flow('pbpath','pbxnorms pbrnorms','sfcmplx ${SOURCES[:-1]}',stdin=0)
Flow('pipath','pixnorms pirnorms','sfcmplx ${SOURCES[:-1]}',stdin=0)
Plot('ppath',
'''
sfgraph label1="\F15 7\F-1 x\F15 7\F-1 \_\s75 1" label2="\F15 7\F-1 y-Ax\F15 7\F-1 \_\s75 2" title=""
min1=%(min1)g max1=%(max1)g min2=%(min2)g max2=%(max2)g
symbol=+ symbolsz=6 parallel2=n
'''%vars() )
Plot('pbpath',
'''
sfgraph label1="\F15 7\F-1 x\F15 7\F-1 \_\s75 1" label2="\F15 7\F-1 y-Ax\F15 7\F-1 \_\s75 2" title=""
min1=%(min1)g max1=%(max1)g min2=%(min2)g max2=%(max2)g
symbol=0 symbolsz=10 plotcol=2 parallel2=n
'''%vars() )
Plot('pipath',
'''
sfgraph label1="\F15 7\F-1 x\F15 7\F-1 \_\s75 1" label2="\F15 7\F-1 y-Ax\F15 7\F-1 \_\s75 2" title=""
min1=%(min1)g max1=%(max1)g min2=%(min2)g max2=%(max2)g parallel2=n
'''%vars() )
matfun = 'TrackCRSIwSPGL1'
Flow('data interp model xnorms rnorms',[os.path.join(matROOT,matfun+'.m')],
matlab + '''
-nosplash -nojvm -r "addpath %(matROOT)s;%(matfun)s('$TARGET','${TARGETS[1]}','${TARGETS[2]}','${TARGETS[3]}','${TARGETS[4]}',%(maxiters)g);quit"
'''%vars(),stdin=0,stdout=-1)
Flow('opath','xnorms rnorms','sfcmplx ${SOURCES[:-1]}',stdin=0)
Plot('opath',
'''
sfgraph label1="\F15 7\F-1 x\F15 7\F-1 \_\s75 1" label2="\F15 7\F-1 y-Ax\F15 7\F-1 \_\s75 2" title=""
min1=%(min1)g max1=%(max1)g min2=%(min2)g max2=%(max2)g
plotcol=3 dash=5 parallel2=n
'''%vars() )
Result('res','ppath pbpath pipath opath','Overlay')
Result('data','sfput d1=.004 |'+mygrey("",label1="Time",label2="Trace #",unit1="s",unit2=""))
Result('interp','sfput d1=.004 |'+mygrey("",label1="Time",label2="Trace #",unit1="s",unit2=""))
End()
|