Changeset 18994 for issm/trunk-jpl/src/m/classes/m1qn3inversion.py
- Timestamp:
- 01/07/15 08:48:32 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/m1qn3inversion.py
r17918 r18994 1 1 import numpy 2 import copy3 2 from fielddisplay import fielddisplay 4 3 from EnumDefinitions import * … … 6 5 from checkfield import checkfield 7 6 from WriteData import WriteData 7 from supportedcontrols import supportedcontrols 8 from supportedcostfunctions import supportedcostfunctions 9 from marshallcostfunctions import marshallcostfunctions 8 10 9 11 class m1qn3inversion(object): … … 119 121 md = checkfield(md,'fieldname','inversion.iscontrol','values',[0,1]) 120 122 md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0,1]) 121 md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values', ['BalancethicknessThickeningRate','FrictionCoefficient','MaterialsRheologyBbar','DamageDbar','Vx','Vy','Thickness'])123 md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',supportedcontrols()) 122 124 md = checkfield(md,'fieldname','inversion.maxsteps','numel',[1],'>=',0) 123 125 md = checkfield(md,'fieldname','inversion.maxiter','numel',[1],'>=',0) 124 126 md = checkfield(md,'fieldname','inversion.dxmin','numel',[1],'>',0.) 125 127 md = checkfield(md,'fieldname','inversion.gttol','numel',[1],'>',0.) 126 md = checkfield(md,'fieldname','inversion.cost_functions','size',[num_costfunc],'values', [101,102,103,104,105,201,501,502,503,504,505])128 md = checkfield(md,'fieldname','inversion.cost_functions','size',[num_costfunc],'values',supportedcostfunctions()) 127 129 md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices,num_costfunc],'>=',0) 128 130 md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices,num_controls]) … … 166 168 #process cost functions 167 169 num_cost_functions=numpy.size(self.cost_functions) 168 data=copy.deepcopy(self.cost_functions) 169 pos=[i for i,x in enumerate(self.cost_functions) if x==101]; 170 for i in pos: data[i]=SurfaceAbsVelMisfitEnum() 171 pos=[i for i,x in enumerate(self.cost_functions) if x==102]; 172 for i in pos: data[i]=SurfaceRelVelMisfitEnum() 173 pos=[i for i,x in enumerate(self.cost_functions) if x==103]; 174 for i in pos: data[i]=SurfaceLogVelMisfitEnum() 175 pos=[i for i,x in enumerate(self.cost_functions) if x==104]; 176 for i in pos: data[i]=SurfaceLogVxVyMisfitEnum() 177 pos=[i for i,x in enumerate(self.cost_functions) if x==105]; 178 for i in pos: data[i]=SurfaceAverageVelMisfitEnum() 179 pos=[i for i,x in enumerate(self.cost_functions) if x==201]; 180 for i in pos: data[i]=ThicknessAbsMisfitEnum() 181 pos=[i for i,x in enumerate(self.cost_functions) if x==501]; 182 for i in pos: data[i]=DragCoefficientAbsGradientEnum() 183 pos=[i for i,x in enumerate(self.cost_functions) if x==502]; 184 for i in pos: data[i]=RheologyBbarAbsGradientEnum() 185 pos=[i for i,x in enumerate(self.cost_functions) if x==503]; 186 for i in pos: data[i]=ThicknessAbsGradientEnum() 187 pos=[i for i,x in enumerate(self.cost_functions) if x==504]; 188 for i in pos: data[i]=ThicknessAlongGradientEnum() 189 pos=[i for i,x in enumerate(self.cost_functions) if x==505]; 190 for i in pos: data[i]=ThicknessAcrossGradientEnum() 170 data=marshallcostfunctions(self.cost_functions) 191 171 WriteData(fid,'data',numpy.array(data).reshape(1,-1),'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3) 192 172 WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer')
Note:
See TracChangeset
for help on using the changeset viewer.