Changeset 24870
- Timestamp:
- 05/17/20 17:15:00 (5 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 1 added
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/qmu/normal_uncertain.m
r24847 r24870 13 13 14 14 classdef normal_uncertain 15 16 descriptor='';17 mean= NaN;18 stddev= NaN;19 partition 20 21 15 properties 16 descriptor = ''; 17 mean = NaN; 18 stddev = NaN; 19 partition = []; 20 end 21 methods 22 22 function self=normal_uncertain(varargin) %constructor {{{ 23 23 … … 46 46 47 47 end %}}} 48 function disp(self) % {{{ 49 50 disp(sprintf(' normal uncertain variable: ')); 51 fielddisplay(self,'descriptor','name tag'); 52 fielddisplay(self,'mean','pdf mean'); 53 fielddisplay(self,'stddev','pdf standard deviation'); 54 if ~isempty(self.partition), 55 fielddisplay(self,'partition','partition vector defining where sampling will occur'); 56 end 57 end 58 %}}} 59 function md=checkconsistency(self,md,solution,analyses) % {{{ 60 61 md = checkfield(md,'field',self.mean,'fieldname','normal_uncertain.mean','NaN',1,'Inf',1,'>=',0); 62 md = checkfield(md,'field',self.stddev,'fieldname','normal_uncertain.stddev','NaN',1,'Inf',1,'>=',0,'numel',length(self.mean)); 63 if self.isscaled(), 64 if isempty(self.partition), 65 error('normal_uncertain is a scaled variable, but it''s missing a partition vector'); 66 end 67 %better have a partition vector that has as many partitions as stddev's size: 68 if length(self.stddev)~=partition_npart(self.partition), 69 error('normal_uncertain error message: stddev and partition should be vectors of identical size'); 70 end 71 if length(self.mean)~=partition_npart(self.partition), 72 error('normal_uncertain error message: mean and partition should be vectors of identical size'); 73 end 74 75 md = checkfield(md,'field',self.partition,'fieldname','normal_uncertain.partition','NaN',1,'Inf',1,'>=',-1,'numel',[md.mesh.numberofvertices,md.mesh.numberofelements]); 76 if size(self.partition,2)>1, 77 error('normal_uncertain error message: partition should be a column vector'); 78 end 79 partcheck=unique(self.partition); 80 partmin=min(partcheck); 81 partmax=max(partcheck); 82 if partmax<-1, 83 error('normal_uncertain error message: partition vector''s min value should be -1 (for no partition), or start at 0'); 84 end 85 nmax=max(md.mesh.numberofelements,md.mesh.numberofvertices); 86 if partmax>nmax, 87 error('normal_uncertain error message: partition vector''s values cannot go over the number of vertices or elements'); 48 function disp(self) % {{{ 49 disp(sprintf(' normal uncertain variable: ')); 50 fielddisplay(self,'descriptor','name tag'); 51 fielddisplay(self,'mean','pdf mean'); 52 fielddisplay(self,'stddev','pdf standard deviation'); 53 if ~isempty(self.partition), 54 fielddisplay(self,'partition','partition vector defining where sampling will occur'); 88 55 end 89 56 end 90 end % }}} 91 %virtual functions needed by qmu processing algorithms: 92 %implemented: 93 function [desc] =prop_desc(nuv,dstr) % {{{ 94 desc=cell(1,numel(nuv)); 95 for i=1:numel(nuv) 96 if ~isempty(nuv(i).descriptor) 97 desc(i)=cellstr(nuv(i).descriptor); 98 elseif ~isempty(inputname(1)) 99 desc(i)=cellstr([inputname(1) string_dim(nuv,i,'vector')]); 100 elseif exist('dstr','var') 101 desc(i)=cellstr([dstr string_dim(nuv,i,'vector')]); 57 %}}} 58 function md=checkconsistency(self,md,solution,analyses) % {{{ 59 60 md = checkfield(md,'field',self.mean,'fieldname','normal_uncertain.mean','NaN',1,'Inf',1,'>=',0); 61 md = checkfield(md,'field',self.stddev,'fieldname','normal_uncertain.stddev','NaN',1,'Inf',1,'>=',0,'numel',length(self.mean)); 62 if self.isscaled(), 63 if isempty(self.partition), 64 error('normal_uncertain is a scaled variable, but it''s missing a partition vector'); 65 end 66 %better have a partition vector that has as many partitions as stddev's size: 67 if length(self.stddev)~=partition_npart(self.partition), 68 error('normal_uncertain error message: stddev and partition should be vectors of identical size'); 69 end 70 if length(self.mean)~=partition_npart(self.partition), 71 error('normal_uncertain error message: mean and partition should be vectors of identical size'); 72 end 73 74 md = checkfield(md,'field',self.partition,'fieldname','normal_uncertain.partition','NaN',1,'Inf',1,'>=',-1,'numel',[md.mesh.numberofvertices,md.mesh.numberofelements]); 75 if size(self.partition,2)>1, 76 error('normal_uncertain error message: partition should be a column vector'); 77 end 78 partcheck=unique(self.partition); 79 partmin=min(partcheck); 80 partmax=max(partcheck); 81 if partmax<-1, 82 error('normal_uncertain error message: partition vector''s min value should be -1 (for no partition), or start at 0'); 83 end 84 nmax=max(md.mesh.numberofelements,md.mesh.numberofvertices); 85 if partmax>nmax, 86 error('normal_uncertain error message: partition vector''s values cannot go over the number of vertices or elements'); 87 end 88 end 89 end % }}} 90 %virtual functions needed by qmu processing algorithms: 91 %implemented: 92 function [desc] =prop_desc(nuv,dstr) % {{{ 93 desc=cell(1,numel(nuv)); 94 for i=1:numel(nuv) 95 if ~isempty(nuv(i).descriptor) 96 desc(i)=cellstr(nuv(i).descriptor); 97 elseif ~isempty(inputname(1)) 98 desc(i)=cellstr([inputname(1) string_dim(nuv,i,'vector')]); 99 elseif exist('dstr','var') 100 desc(i)=cellstr([dstr string_dim(nuv,i,'vector')]); 101 else 102 desc(i)=cellstr(['nuv' string_dim(nuv,i,'vector')]); 103 end 104 end 105 desc=allempty(desc); 106 end %}}} 107 function [mean] =prop_mean(nuv) % {{{ 108 mean=zeros(1,numel(nuv)); 109 for i=1:numel(nuv) 110 mean(i)=nuv(i).mean; 111 end 112 end % }}} 113 function [stddev]=prop_stddev(nuv) % {{{ 114 stddev=zeros(1,numel(nuv)); 115 for i=1:numel(nuv) 116 stddev(i)=nuv(i).stddev; 117 end 118 end % }}} 119 %default 120 function [abscissas] =prop_abscissas(hbu) % {{{ 121 abscissas=[]; 122 end % }}} 123 function [counts] =prop_counts(hbu) % {{{ 124 counts=[]; 125 end % }}} 126 function [pairs_per_variable] =prop_pairs_per_variable(hbu) % {{{ 127 pairs_per_variable=[]; 128 end % }}} 129 function [initpt]=prop_initpt(nuv) % {{{ 130 initpt=[]; 131 end % }}} 132 function [lower] =prop_lower(nuv) % {{{ 133 lower=[]; 134 end % }}} 135 function [upper] =prop_upper(nuv) % {{{ 136 upper=[]; 137 end % }}} 138 function [initst]=prop_initst(nuv) % {{{ 139 initst=[]; 140 end % }}} 141 function [stype] =prop_stype(nuv) % {{{ 142 stype={}; 143 end % }}} 144 function [scale] =prop_scale(nuv) % {{{ 145 scale=[]; 146 end % }}} 147 %new methods: 148 function scaled =isscaled(self) % {{{ 149 if strncmp(self.descriptor,'scaled_',7), 150 scaled=1; 102 151 else 103 desc(i)=cellstr(['nuv' string_dim(nuv,i,'vector')]);152 scaled=0; 104 153 end 105 end 106 desc=allempty(desc); 107 end %}}} 108 function [mean] =prop_mean(nuv) % {{{ 109 mean=zeros(1,numel(nuv)); 110 for i=1:numel(nuv) 111 mean(i)=nuv(i).mean; 112 end 113 end % }}} 114 function [stddev]=prop_stddev(nuv) % {{{ 115 stddev=zeros(1,numel(nuv)); 116 for i=1:numel(nuv) 117 stddev(i)=nuv(i).stddev; 118 end 119 end % }}} 120 %default 121 function [abscissas] =prop_abscissas(hbu) % {{{ 122 abscissas=[]; 123 end % }}} 124 function [counts] =prop_counts(hbu) % {{{ 125 counts=[]; 126 end % }}} 127 function [pairs_per_variable] =prop_pairs_per_variable(hbu) % {{{ 128 pairs_per_variable=[]; 129 end % }}} 130 function [initpt]=prop_initpt(nuv) % {{{ 131 initpt=[]; 132 end % }}} 133 function [lower] =prop_lower(nuv) % {{{ 134 lower=[]; 135 end % }}} 136 function [upper] =prop_upper(nuv) % {{{ 137 upper=[]; 138 end % }}} 139 function [initst]=prop_initst(nuv) % {{{ 140 initst=[]; 141 end % }}} 142 function [stype] =prop_stype(nuv) % {{{ 143 stype={}; 144 end % }}} 145 function [scale] =prop_scale(nuv) % {{{ 146 scale=[]; 147 end % }}} 148 %new methods: 149 function scaled =isscaled(self) % {{{ 150 if strncmp(self.descriptor,'scaled_',7), 151 scaled=1; 152 else 153 scaled=0; 154 end 155 end % }}} 154 end % }}} 156 155 end 157 158 156 methods (Static) 157 function []=dakota_write(fidi,dvar) % {{{ 159 158 % collect only the variables of the appropriate class 160 159 nuv=struc_class(dvar,'normal_uncertain'); 161 160 % write variables 162 163 164 161 vlist_write(fidi,'normal_uncertain','nuv',nuv); 162 end % }}} 163 end 165 164 end -
issm/trunk-jpl/src/m/classes/qmu/normal_uncertain.py
r24849 r24870 1 1 import numpy as np 2 2 3 from MatlabArray import * 4 from MatlabFuncs import * 5 from fielddisplay import fielddisplay 6 from pairoptions import pairoptions 7 from partition_npart import * 3 8 4 9 5 10 class normal_uncertain(object): 6 11 ''' 7 definition for the normal_uncertain class. 8 9 [nuv] = normal_uncertain.normal_uncertain(args) 10 nuv = normal_uncertain() 11 12 where the required args are: 13 descriptor (str, description, '') 14 mean (float, mean, float('NaN')) 15 stddev (float, standard deviation, float('NaN')) 16 and the optional args and defaults are: 17 lower (float, lower bound, -np.Inf) 18 upper (float, upper bound, np.Inf) 19 20 note that zero arguments constructs a default instance, one 21 argument of the class copies the instance, and three or more 22 arguments constructs a new instance from the arguments. 23 ''' 12 NORMAL_UNCERTAIN class definition 13 14 Usage: 15 nuv = normal_uncertain('descriptor',descriptor,'mean',mean,'stddev',stddev,'partition',partition) 16 where nuv is the normal_uncertain object returned by the constructor, mean and stddev are self 17 explanatory. partition is the partition vector for distributed variables. Can be a partition 18 vector over elements or vertices. 19 20 Example: 21 md.qmu.variables.rheology=normal_uncertain( 22 'descriptor','RheologyBBar', 23 'mean',1, 24 'stddev',.05 25 ) 26 md.qmu.variables.rheology=normal_uncertain( 27 'descriptor','scaled_RheologyBBar', 28 'mean',1, 29 'stddev',.05, 30 'partition',vpartition 31 ) 32 ''' 24 33 def __init__(self): 25 34 self.descriptor = '' 26 self.mean = float('NaN') 27 self.stddev = float('NaN') 28 self.lower = -np.Inf 29 self.upper = np.Inf 30 31 @staticmethod 32 def normal_uncertain(*args): 35 self.mean = np.NaN 36 self.stddev = np.NaN 37 self.partition = [] 38 39 @staticmethod 40 def normal_uncertain(*args): #{{{ 33 41 nargin = len(args) 34 42 … … 44 52 raise RuntimeError('Object ' + str(args[0]) + ' is a ' + str(type(args[0])) + ' class object, not "normal_uncertain".') 45 53 46 # not enough arguments 47 elif nargin == 2: 48 raise RuntimeError('Construction of "normal_uncertain" class object requires at least 3 inputs.') 49 50 # create the object from the input 54 # create the object from the input 51 55 else: 52 56 # lines differ here in other classes / tests; see asizec problem in notes 53 57 nuv = normal_uncertain() 54 nuv.descriptor = str(args[0]) 55 nuv.mean = args[1] 56 nuv.stddev = args[2] 57 if nargin >= 4: 58 nuv.lower = args[3] 59 if nargin >= 5: 60 nuv.upper = args[4] 61 if nargin > 5: 62 print('WARNING: normal_uncertain:extra_arg: Extra arguments for object of class ' + str(type(nuv)) + '.') 63 64 return [nuv] 65 66 def __repr__(self): 67 # display an individual object 68 string = '\n' 69 string += 'class "normal_uncertain" object = \n' 70 string += ' descriptor: ' + str(self.descriptor) + '\n' 71 string += ' mean: ' + str(self.mean) + '\n' 72 string += ' stddev: ' + str(self.stddev) + '\n' 73 string += ' lower: ' + str(self.lower) + '\n' 74 string += ' upper: ' + str(self.upper) + '\n' 58 59 #recover options: 60 options = pairoptions(*args) 61 62 #initialize fields: 63 nuv.descriptor = options.getfieldvalue('descriptor', '') 64 nuv.mean = options.getfieldvalue('mean', np.NaN) 65 nuv.stddev = options.getfieldvalue('stddev', np.NaN) 66 67 #if the variable is scaled, a partition vector should have been supplied, and 68 #that partition vector should have as many partitions as the mean and stddev 69 #vectors: 70 if nuv.isscaled(): 71 nuv.partition = options.getfieldvalue('partition') 72 npart = partition_npart(nuv.partition) 73 if npart != len(nuv.mean): 74 error("normal_uncertain constructor: for the scaled variable %s the mean field is not currently a vector of values for all the partitions described in the partition vector" % nuv.descriptor) 75 if npart != len(nuv.stddev): 76 error("normal_uncertain constructor: for the scaled variable %s the stddev field is not cureently a vector of values for all the partitions described in the partition vector" % nuv.descriptor) 77 78 return [nuv] # Always return a list, so we have something akin to a MATLAB single row matrix 79 #}}} 80 81 def __repr__(self): #{{{ 82 string = ' normal uncertain variable: ' 83 string = "%s\n%s" % (string, fielddisplay(self, 'descriptor', 'name tag')) 84 string = "%s\n%s" % (string, fielddisplay(self, 'mean', 'pdf mean')) 85 string = "%s\n%s" % (string, fielddisplay(self, 'stddev', 'pdf standard deviation')) 86 if self.partition != []: 87 string = "%s\n%s" % (string, fielddisplay(self, 'partition', 'partition vector defining where sampling will occur')) 75 88 76 89 return string 77 78 # from here on, nuv is either a single, or a 1d vector of, normal_uncertain 79 80 @staticmethod 81 def prop_desc(nuv, dstr): 82 if type(nuv) not in [list, np.ndarray]: 83 if nuv.descriptor != '' or type(nuv.descriptor) != str: 84 desc = str(nuv.descriptor) 85 elif dstr != '': 86 desc = str(dstr) 87 else: 88 desc = 'nuv' 89 return desc 90 90 #}}} 91 92 def __len__(self): #{{{ 93 if type(self.mean) in [list, np.ndarray]: 94 return len(self.mean) 95 else: 96 return 1 97 #}}} 98 99 def checkconsistency(self, md, solution, analyses): #{{{ 100 md = checkfield(md, 'field', self.mean, 'fieldname', 'normal_uncertain.mean', 'NaN', 1, 'Inf', 1, '>=', 0) 101 md = checkfield(md, 'field', self.stddev, 'fieldname', 'normal_uncertain.stddev', 'NaN', 1, 'Inf', 1, '>=', 0, 'numel', len(self.mean)) 102 if self.isscaled(): 103 if self.partition == []: 104 error("normal_uncertain is a scaled variable, but it's missing a partition vector") 105 #better have a partition vector that has as many partitions as stddev's size: 106 if len(self.stddev) != partition_npart(self.partititon): 107 error("normal_uncertain error message: stddev and partition should be vectors of identical size") 108 if len(self.mean) != partition_npart(self.partition): 109 error("normal_uncertain error message: mean and partition should be vectors of identical size") 110 md = checkfield(md, 'field', self.partition, 'fieldname', 'normal_uncertain.partition', 'NaN', 1, 'Inf', 1, '>=', -1, 'numel', [md.mesh.numberofvertices, md.mesh.numberofvertices]) 111 if self.partition.shape[1] > 1: 112 error("normal_uncertain error message: partition should be a column vector") 113 partcheck = np.unique(self.partition) 114 partmin = min(partcheck) 115 partmax = max(partcheck) 116 if partmax < -1: 117 error("normal_uncertain error message: partition vector's min value should be -1 (for no partition), or start at 0") 118 nmax = max(md.mesh.numberofelements, md.mesh.numberofvertices) 119 if partmax > nmax: 120 error("normal_uncertain error message: partition vector's values cannot go over the number of vertices or elements") 121 #}}} 122 123 #virtual functions needed by qmu processing algorithms 124 #implemented: 125 126 @staticmethod 127 def prop_desc(nuv, dstr): #{{{ 91 128 desc = ['' for i in range(np.size(nuv))] 92 129 for i in range(np.size(nuv)): … … 101 138 102 139 return desc 103 104 @staticmethod 105 def prop_initpt(nuv): 106 initpt = [] 107 return initpt 108 109 @staticmethod 110 def prop_lower(nuv): 140 #}}} 141 142 @staticmethod 143 def prop_mean(nuv): #{{{ 111 144 if type(nuv) not in [list, np.ndarray]: 112 return nuv.lower 113 114 lower = np.zeros(np.size(nuv)) 115 for i in range(np.size(nuv)): 116 lower[i] = nuv[i].lower 117 118 lower = allequal(lower, -np.inf) 119 120 return lower 121 122 @staticmethod 123 def prop_upper(nuv): 124 if type(nuv) not in [list, np.ndarray]: 125 return nuv.upper 126 127 upper = np.zeros(np.size(nuv)) 128 for i in range(np.size(nuv)): 129 upper[i] = nuv[i].upper 130 131 upper = allequal(upper, -np.inf) 132 return upper 133 134 @staticmethod 135 def prop_mean(nuv): 136 if type(nuv) not in [list, np.ndarray]: 137 return nuv.mean 145 return [nuv.mean] 138 146 139 147 mean = np.zeros(np.size(nuv)) 140 148 for i in range(np.size(nuv)): 141 149 mean[i] = nuv[i].mean 142 143 150 return mean 144 145 @staticmethod 146 def prop_stddev(nuv): 151 #}}} 152 153 @staticmethod 154 def prop_stddev(nuv): #{{{ 147 155 if type(nuv) not in [list, np.ndarray]: 148 return nuv.stddev 149 156 return [nuv.stddev] 150 157 stddev = np.zeros(np.size(nuv)) 151 158 for i in range(np.size(nuv)): 152 159 stddev[i] = nuv[i].stddev 153 154 160 return stddev 155 156 @staticmethod 157 def prop_initst(nuv): 158 initst = [] 159 return initst 160 161 @staticmethod 162 def prop_stype(nuv): 161 #}}} 162 163 #default 164 @staticmethod 165 def prop_abscissas(hbu): #{{{ 166 abscissas = [] 167 return abscissas 168 #}}} 169 170 @staticmethod 171 def prop_counts(hbu): #{{{ 172 counts = [] 173 return counts 174 #}}} 175 176 @staticmethod 177 def prop_pairs_per_variable(hbu): #{{{ 178 pairs_per_variable = [] 179 return pairs_per_variable 180 #}}} 181 182 @staticmethod 183 def prop_initpt(nuv): #{{{ 184 initpt = [] 185 return initpt 186 #}}} 187 188 @staticmethod 189 def prop_lower(nuv): #{{{ 190 lower = [] 191 return lower 192 #}}} 193 194 @staticmethod 195 def prop_upper(nuv): #{{{ 196 upper = [] 197 return upper 198 #}}} 199 200 @staticmethod 201 def prop_initst(nuv): #{{{ 202 inist = [] 203 return inist 204 #}}} 205 206 @staticmethod 207 def prop_stype(nuv): #{{{ 163 208 stype = [] 164 209 return stype 165 166 @staticmethod 167 def prop_scale(nuv): 210 #}}} 211 212 @staticmethod 213 def prop_scale(nuv): #{{{ 168 214 scale = [] 169 215 return scale 216 #}}} 217 218 #new methods: 219 def isscaled(self): #{{{ 220 if strncmp(self.descriptor, 'scaled_', 7): 221 return True 222 else: 223 return False 224 #}}} 170 225 171 226 @staticmethod 172 227 def dakota_write(fidi, dvar): 228 # possible namespace pollution, the above import seems not to work 229 from vlist_write import vlist_write 173 230 # collect only the variables of the appropriate class 174 nuv = [struc_class(i, 'normal_uncertain', 'nuv') for i in dvar] 175 176 # possible namespace pollution, the above import seems not to work 177 from vlist_write import vlist_write 178 # write variables 179 vlist_write(fidi, 'normal_uncertain', 'nuv', nuv) 231 # nuv = [struc_class(i, 'normal_uncertain', 'nuv') for i in dvar] 232 fields = fieldnames(dvar) 233 for field in fields: 234 if getattr(dvar, field)[0].__class__.__name__ != 'normal_uncertain': 235 delattr(dvar, field) 236 if len(dvar) > 0: 237 vlist_write(fidi, 'normal_uncertain', 'nuv', dvar) 238 #}}} 239 -
issm/trunk-jpl/src/m/classes/qmu/partition_npart.m
r24836 r24870 1 1 function npart=partition_npart(vector) 2 2 3 %vector could be on vertices or ele emnts, and will have a small amount of possible integer3 %vector could be on vertices or elements, and will have a small amount of possible integer 4 4 %values: 5 5 uvec=unique(vector); -
issm/trunk-jpl/src/m/classes/qmu/response_function.m
r24839 r24870 19 19 rell =[]; 20 20 grell =[]; 21 21 partition = []; 22 22 end 23 23 methods … … 35 35 self.grell=getfieldvalue(options,'general_reliability_levels',[]); 36 36 37 %if the response is scaled, 37 %if the response is scaled, a partition vector should have been supplied. 38 38 if self.isscaled(), 39 39 self.partition=getfieldvalue(options,'partition'); … … 42 42 end %}}} 43 43 function []=disp(rf)% {{{ 44 45 46 % display the object 47 44 %TODO: Convert the following to fielddisplay 45 % display the object 48 46 disp(sprintf('\n')); 49 47 for i=1:numel(rf) … … 54 52 disp(sprintf(' probl: %s' ,string_vec(rf(i).probl))); 55 53 disp(sprintf(' rell: %s' ,string_vec(rf(i).rell))); 56 disp(sprintf(' grell: %s\n' ,string_vec(rf(i).grell))); 54 disp(sprintf(' grell: %s' ,string_vec(rf(i).grell))); 55 if ~isempty(self.partition), 56 disp(sprintf(' partition: %s' ,string_vec(rf(i).partition))); 57 end 58 disp(sprintf('\n')); 57 59 end 58 60 … … 127 129 %collect only the responses of the appropriate class 128 130 rf=struc_class(dresp,'response_function'); 129 130 131 %write responses 131 132 [rdesc]=rlist_write(fidi,'response_functions','response_function',rf,rdesc); -
issm/trunk-jpl/src/m/classes/qmu/response_function.py
r24213 r24870 1 1 import numpy as np 2 3 from MatlabFuncs import * 4 from fielddisplay import fielddisplay 5 from pairoptions import pairoptions 6 from partition_npart import * 7 from rlev_write import * 2 8 #from rlist_write import * 3 from rlev_write import *4 from MatlabArray import *5 #move this later6 from helpers import *7 9 8 10 9 11 class response_function(object): 10 12 ''' 11 definition for the response_function class. 12 13 [rf] = response_function.response_function(args) 14 rf = response_function() 15 16 where the required args are: 17 descriptor (char, description, '') 18 and the optional args and defaults are: 19 respl (double vector, response levels, []) 20 probl (double vector, probability levels, []) 21 rell (double vector, reliability levels, []) 22 grell (double vector, gen. reliability levels, []) 23 24 note that zero arguments constructs a default instance, one 25 argument of the class copies the instance, and one or more 26 arguments constructs a new instance from the arguments. 27 ''' 28 13 RESPONSE_FUNCTION class definition 14 15 Usage: 16 rf = response_function( 17 'descriptor', descriptor, 18 'response_levels', respl, 19 'probability_levels', probl, 20 'reliability_levels',rell, 21 'general_reliability_levels', grell, 22 'partition', partition 23 ) 24 25 where rf is the response function object returned by the 26 constructor. All options except the descriptor are optional. A partition can be provided for scaled variables. 27 28 Example: 29 md.qmu.responses.maxvel = response_function( 30 'descriptor', 'MaxVel', 31 'response_levels',[0], 32 'probl', [0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999] 33 ) 34 ''' 29 35 def __init__(self): 30 36 self.descriptor = '' 31 self.respl = [] 32 self.probl = [] 33 self.rell = [] 34 self.grell = [] 37 self.respl = [] 38 self.probl = [] 39 self.rell = [] 40 self.grell = [] 41 self.partition = [] 35 42 36 43 @staticmethod … … 43 50 44 51 # copy the object or create the object from the input 45 el se:46 if nargin == 1 andisinstance(args[0], response_function):52 elif nargin == 1: 53 if isinstance(args[0], response_function): 47 54 rf = args[0] 48 55 else: 49 asizec = array_size(*args[0:min(nargin, 1)]) 50 rf = [response_function() for i in range(asizec[0]) for j in range(asizec[1])] 51 52 for i in range(np.size(rf)): 53 if (np.size(args[0]) > 1): 54 rf[i].descriptor = args[0][i] 55 else: 56 rf[i].descriptor = str(args[0]) + string_dim(rf, i, 'vector') 57 58 if nargin >= 2: 59 for i in range(np.size(rf)): 60 rf[i].respl = args[1] 61 62 if nargin >= 3: 63 for i in range(np.size(rf)): 64 rf[i].probl = args[2] 65 66 if nargin >= 4: 67 for i in range(np.size(rf)): 68 rf[i].rell = args[3] 69 70 if nargin >= 5: 71 for i in range(np.size(rf)): 72 rf[i].grell = args[4] 73 74 if nargin > 5: 75 print('WARNING: response_function:extra_arg: Extra arguments for object of class ' + str(type(rf)) + '.') 76 77 return rf 78 79 def __repr__(self): 80 # display the object 81 string = '\n' 82 string += 'class "response_function" object = \n' 83 string += ' descriptor: ' + str(self.descriptor) + '\n' 84 string += ' respl: ' + str(self.respl) + '\n' 85 string += ' probl: ' + str(self.probl) + '\n' 86 string += ' rell: ' + str(self.rell) + '\n' 87 string += ' grell: ' + str(self.grell) + '\n' 56 raise RuntimeError('Object ' + str(args[0]) + ' is a ' + str(type(args[0])) + ' class object, not "response_function".') 57 else: 58 # asizec = array_size(*args[0:min(nargin, 1)]) 59 # rf = [response_function() for i in range(asizec[0]) for j in range(asizec[1])] 60 61 # for i in range(np.size(rf)): 62 # if (np.size(args[0]) > 1): 63 # rf[i].descriptor = args[0][i] 64 # else: 65 # rf[i].descriptor = str(args[0]) + string_dim(rf, i, 'vector') 66 67 # if nargin >= 2: 68 # for i in range(np.size(rf)): 69 # rf[i].respl = args[1] 70 71 # if nargin >= 3: 72 # for i in range(np.size(rf)): 73 # rf[i].probl = args[2] 74 75 # if nargin >= 4: 76 # for i in range(np.size(rf)): 77 # rf[i].rell = args[3] 78 79 # if nargin >= 5: 80 # for i in range(np.size(rf)): 81 # rf[i].grell = args[4] 82 83 # if nargin > 5: 84 # print('WARNING: response_function:extra_arg: Extra arguments for object of class ' + str(type(rf)) + '.') 85 86 rf = response_function() 87 88 #recover options: 89 options = pairoptions(*args) 90 91 #initialize fields: 92 rf.descriptor = options.getfieldvalue('descriptor') 93 rf.respl = options.getfieldvalue('response_levels', []) 94 rf.probl = options.getfieldvalue('probability_levels', [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 95 rf.rell = options.getfieldvalue('reliability_levels', []) 96 rf.grell = options.getfieldvalue('general_reliability_levels', []) 97 98 #if the response is scaled, a partition vector should have been supplied. 99 if rf.isscaled(): 100 rf.partition = options.getfieldvalue('partition') 101 npart = partition_npart(rf.partition) 102 103 return [rf] # Always return a list, so we have something akin to a MATLAB single row matrix 104 105 def __repr__(self): #{{{ 106 # display the object 107 string = 'class "response_function" object = \n' 108 string = "%s\n%s" % (string, fielddisplay(self, 'descriptor', 'name tag')) 109 string = "%s\n%s" % (string, fielddisplay(self, 'respl', 'response levels')) 110 string = "%s\n%s" % (string, fielddisplay(self, 'probl', 'probability levels')) 111 string = "%s\n%s" % (string, fielddisplay(self, 'rell', 'reliability levels')) 112 string = "%s\n%s" % (string, fielddisplay(self, 'grell', 'general reliability levels')) 113 114 if self.partition != []: 115 string = "%s\n%s" % (string, fielddisplay(self, 'partition', 'partition')) 88 116 89 117 return string 90 91 def __len__(self): 118 #}}} 119 120 def __len__(self): #{{{ 92 121 return max(len(self.respl), len(self.probl), len(self.rell), len(self.grell)) 93 94 # from here on, rf is either a single, or a 1d vector of, response_function 95 96 @staticmethod 97 def prop_desc(rf, dstr): 98 # response_function is always a vector, or should be, even with just 1 99 if type(rf) not in [list, np.ndarray]: 100 rf = [rf] 101 122 #}}} 123 124 @staticmethod 125 def prop_desc(rf, dstr): #{{{ 102 126 desc = ['' for i in range(np.size(rf))] 103 127 for i in range(np.size(rf)): … … 111 135 desc = allempty(desc) 112 136 return desc 113 114 @staticmethod 115 def prop_stype(rf): 137 #}}} 138 139 @staticmethod 140 def prop_stype(rf): #{{{ 116 141 stype = [] 117 142 return stype 118 119 @staticmethod 120 def prop_scale(rf): 143 #}}} 144 145 @staticmethod 146 def prop_scale(rf): #{{{ 121 147 scale = [] 122 148 return scale 123 124 @staticmethod 125 def prop_weight(rf): 149 #}}} 150 151 @staticmethod 152 def prop_weight(rf): #{{{ 126 153 weight = [] 127 154 return weight 128 129 @staticmethod 130 def prop_lower(rf): 155 #}}} 156 157 @staticmethod 158 def prop_lower(rf): #{{{ 131 159 lower = [] 132 160 return lower 133 134 @staticmethod 135 def prop_upper(rf): 161 #}}} 162 163 @staticmethod 164 def prop_upper(rf): #{{{ 136 165 upper = [] 137 166 return upper 138 139 @staticmethod 140 def prop_target(rf): 167 #}}} 168 169 @staticmethod 170 def prop_target(rf): #{{{ 141 171 target = [] 142 172 return target 173 #}}} 143 174 144 175 @staticmethod 145 176 def prop_levels(rf): 146 # response_function is always a vector, or should be, even with just 1147 if type(rf) not in [list, np.ndarray]:148 rf = [rf]149 150 177 respl = empty_nd_list(np.size(rf)) 151 178 probl = empty_nd_list(np.size(rf)) 152 179 rell = empty_nd_list(np.size(rf)) 153 180 grell = empty_nd_list(np.size(rf)) 154 155 181 for i in range(np.size(rf)): 156 182 respl[i] = rf[i].respl … … 158 184 rell[i] = rf[i].rell 159 185 grell[i] = rf[i].grell 160 161 186 respl = allempty(respl) 162 187 probl = allempty(probl) … … 165 190 return [respl, probl, rell, grell] 166 191 192 #new methods: 193 def isscaled(self): #{{{ 194 if strncmpi(self.descriptor, 'scaled_', 7): 195 return True 196 else: 197 return False 198 #}}} 199 167 200 @staticmethod 168 201 def dakota_write(fidi, dresp, rdesc): 169 # collect only the responses of the appropriate class170 rf = [struc_class(vars(dresp)[i][j], 'response_function', 'rf') for i in fieldnames(dresp) for j in range(len(vars(dresp)[i]))]171 172 202 #possible namespace pollution here 173 203 from rlist_write import rlist_write 174 # write responses 175 rdesc = rlist_write(fidi, 'response_function', 'rf', rf, rdesc) 176 204 # collect only the responses of the appropriate class 205 #rf = [struc_class(vars(dresp)[i][j], 'response_function', 'rf') for i in fieldnames(dresp) for j in range(len(vars(dresp)[i]))] 206 fields = fieldnames(dresp) 207 for field in fields: 208 if getattr(dresp, field)[0].__class__.__name__ != 'response_function': 209 delattr(dresp, field) 210 if len(dresp) > 0: 211 rdesc = rlist_write(fidi, 'response_function', 'rf', dresp, rdesc) 177 212 return rdesc 178 213 -
issm/trunk-jpl/src/m/classes/qmu/uniform_uncertain.m
r24836 r24870 13 13 14 14 classdef uniform_uncertain 15 16 descriptor='';17 lower =-Inf;18 upper= Inf;19 partition 20 21 15 properties 16 descriptor = ''; 17 lower = -Inf; 18 upper = Inf; 19 partition = []; 20 end 21 methods 22 22 function self=uniform_uncertain(varargin) %constructor {{{ 23 23 … … 30 30 self.lower=getfieldvalue(options,'lower'); 31 31 32 %if the variable is scaled, a partition vector should have been supplied, and33 % that partition vector should have as many partitions as the lower and upper34 % vectors:32 %if the variable is scaled, a partition vector should have been 33 %supplied, and that partition vector should have as many 34 %partitions as the lower and upper vectors: 35 35 if self.isscaled(), 36 36 self.partition=getfieldvalue(options,'partition'); … … 40 40 end 41 41 if npart~=length(self.lower), 42 error(['uniform_uncertain constructor: for the scaled variable' self.descri bed' the lower field is not currently a vector of values for all the partitions described in the partition vector']);42 error(['uniform_uncertain constructor: for the scaled variable' self.descriptor ' the lower field is not currently a vector of values for all the partitions described in the partition vector']); 43 43 end 44 44 end … … 58 58 function md=checkconsistency(self,md,solution,analyses) % {{{ 59 59 60 md = checkfield(md,'field',self.upper,'fieldname','uniform_uncertain.upper','NaN',1,'Inf',1,'>',self.lower,'numel',length(self.lower)); 61 md = checkfield(md,'field',self.lower,'fieldname','uniform_uncertain.lower','NaN',1,'Inf',1,'<',self.upper,'numel',length(self.upper)); 62 if self.isscaled(), 63 if isempty(self.partition), 64 error('normal_uncertain is a scaled variable, but it''s missing a partition vector'); 60 md = checkfield(md,'field',self.upper,'fieldname','uniform_uncertain.upper','NaN',1,'Inf',1,'>',self.lower,'numel',length(self.lower)); 61 md = checkfield(md,'field',self.lower,'fieldname','uniform_uncertain.lower','NaN',1,'Inf',1,'<',self.upper,'numel',length(self.upper)); 62 if self.isscaled(), 63 if isempty(self.partition), 64 error('uniform_uncertain is a scaled variable, but it''s missing a partition vector'); 65 end 66 %better have a partition vector that has as many partitions as upper and lower's size: 67 if length(self.upper)~=partition_npart(self.partition), 68 error('uniform_uncertain error message: upper and partition should be vectors of identical size'); 69 end 70 if length(self.lower)~=partition_npart(self.partition), 71 error('uniform_uncertain error message: lower and partition should be vectors of identical size'); 72 end 73 74 md = checkfield(md,'field',self.partition,'fieldname','uniform_uncertain.partition','NaN',1,'Inf',1,'>=',-1,'numel',[md.mesh.numberofvertices,md.mesh.numberofelements]); 75 if size(self.partition,2)>1, 76 error('uniform_uncertain error message: partition should be a column vector'); 77 end 78 partcheck=unique(self.partition); 79 partmin=min(partcheck); 80 partmax=max(partcheck); 81 if partmax<-1, 82 error('uniform_uncertain error message: partition vector''s min value should be -1 (for no partition), or start at 0'); 83 end 84 nmax=max(md.mesh.numberofelements,md.mesh.numberofvertices); 85 if partmax>nmax, 86 error('uniform_uncertain error message: partition vector''s values cannot go over the number of vertices or elements'); 87 end 65 88 end 66 %better have a partition vector that has as many partitions as stddev's size: 67 if length(self.upper)~=partition_npart(self.partition), 68 error('uniform_uncertain error message: upper and partition should be vectors of identical size'); 69 end 70 if length(self.lower)~=partition_npart(self.partition), 71 error('uniform_uncertain error message: lower and partition should be vectors of identical size'); 72 end 73 74 md = checkfield(md,'field',self.partition,'fieldname','normal_uncertain.partition','NaN',1,'Inf',1,'>=',-1,'numel',[md.mesh.numberofvertices,md.mesh.numberofelements]); 75 if size(self.partition,2)>1, 76 error('uniform_uncertain error message: partition should be a column vector'); 77 end 78 partcheck=unique(self.partition); 79 partmin=min(partcheck); 80 partmax=max(partcheck); 81 if partmax<-1, 82 error('uniform_uncertain error message: partition vector''s min value should be -1 (for no partition), or start at 0'); 83 end 84 nmax=max(md.mesh.numberofelements,md.mesh.numberofvertices); 85 if partmax>nmax, 86 error('uniform_uncertain error message: partition vector''s values cannot go over the number of vertices or elements'); 87 end 88 end 89 end % }}} 90 %virtual functions needed by qmu processing algorithms: 91 %implemented: 92 function [desc] =prop_desc(uuv,dstr) % {{{ 89 end % }}} 90 %virtual functions needed by qmu processing algorithms: 91 %implemented: 92 function [desc] = prop_desc(uuv,dstr) % {{{ 93 93 desc=cell(1,numel(uuv)); 94 94 for i=1:numel(uuv) … … 105 105 desc=allempty(desc); 106 106 end %}}} 107 function [lower] = prop_lower(uuv) % {{{107 function [lower] = prop_lower(uuv) % {{{ 108 108 lower=zeros(1,numel(uuv)); 109 109 for i=1:numel(uuv) … … 112 112 lower=allequal(lower,-Inf); 113 113 end %}}} 114 function [upper] = prop_upper(uuv) % {{{114 function [upper] = prop_upper(uuv) % {{{ 115 115 upper=zeros(1,numel(uuv)); 116 116 for i=1:numel(uuv) … … 119 119 upper=allequal(upper, Inf); 120 120 end % }}} 121 %default121 %default 122 122 function [stddev]=prop_stddev(uuv) %{{{ 123 123 stddev=[]; 124 125 124 end % }}} 125 function [mean] =prop_mean(nuv) % {{{ 126 126 mean=[]; 127 128 127 end % }}} 128 function [initpt]=prop_initpt(uuv) %{{{ 129 129 initpt=[]; 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 function [pairs_per_variable] =prop_pairs_per_variable(hbu) % {{{147 pairs_per_variable=[];148 end % }}}149 %new methods:150 function scaled =isscaled(self) % {{{151 if strncmp(self.descriptor,'scaled_',7),152 scaled=1;153 else154 scaled=0;155 end156 end % }}}157 130 end %}}} 131 function [initst]=prop_initst(uuv) %{{{ 132 initst=[]; 133 end %}}} 134 function [stype] =prop_stype(uuv) %{{{ 135 stype={}; 136 end %}}} 137 function [scale] =prop_scale(uuv) %{{{ 138 scale=[]; 139 end %}}} 140 function [abscissas] =prop_abscissas(hbu) % {{{ 141 abscissas=[]; 142 end % }}} 143 function [counts] =prop_counts(hbu) % {{{ 144 counts=[]; 145 end % }}} 146 function [pairs_per_variable] =prop_pairs_per_variable(hbu) % {{{ 147 pairs_per_variable=[]; 148 end % }}} 149 %new methods: 150 function scaled =isscaled(self) % {{{ 151 if strncmp(self.descriptor,'scaled_',7), 152 scaled=1; 153 else 154 scaled=0; 155 end 156 end % }}} 157 end 158 158 methods (Static) 159 159 function []=dakota_write(fidi,dvar) % {{{ 160 160 % collect only the variables of the appropriate class 161 161 uuv=struc_class(dvar,'uniform_uncertain'); 162 162 % write variables 163 164 165 163 vlist_write(fidi,'uniform_uncertain','uuv',uuv); 164 end %}}} 165 end 166 166 end -
issm/trunk-jpl/src/m/classes/qmu/uniform_uncertain.py
r24261 r24870 1 1 import numpy as np 2 #from vlist_write import * 2 3 3 from MatlabArray import * 4 from MatlabFuncs import * 5 from fielddisplay import fielddisplay 6 from pairoptions import pairoptions 7 from partition_npart import * 4 8 5 9 6 10 class uniform_uncertain(object): 7 11 ''' 8 definition for the uniform_uncertain class. 9 10 [uuv] = uniform_uncertain.uniform_uncertain(args) 11 uuv = uniform_uncertain() 12 13 where the required args are: 14 descriptor (str, description, '') 15 lower (float, lower bound, -np.Inf) 16 upper (float, upper bound, np.Inf) 17 18 note that zero arguments constructs a default instance, one 19 argument of the class copies the instance, and three or more 20 arguments constructs a new instance from the arguments. 21 ''' 22 12 UNIFORM_UNCERTAIN class definition 13 14 Usage: 15 nuv = uniform_uncertain( 16 'descriptor', descriptor, 17 'lower', lower, 18 'upper', upper, 19 'partition', partition 20 ) 21 22 where nuv is the uniform_uncertain object returned by the constructor, 23 lower and upper are the pdf distribution bounds, and partition is the 24 partition vector for distributed variables. Can be a partition vector 25 over elements or vertices. 26 27 Example: 28 md.qmu.variables.rheology = uniform_uncertain( 29 'descriptor', 'RheologyBBar', 30 'lower', 1e8, 31 'upper', 1e9 32 ) 33 md.qmu.variables.rheology = uniform_uncertain( 34 'descriptor', 'RheologyBBar', 35 'lower', 1e8, 36 'upper', 1e9, 37 'partition', vpartition 38 ) 39 ''' 23 40 def __init__(self): 24 41 self.descriptor = '' 25 self.lower = -np.Inf 26 self.upper = np.Inf 42 self.lower = -np.Inf 43 self.upper = np.Inf 44 self.partition = [] 27 45 28 46 @staticmethod … … 41 59 raise RuntimeError('Object ' + str(args[0]) + ' is a ' + str(type(args[0])) + ' class object, not "uniform_uncertain".') 42 60 43 # not enough arguments44 elif nargin == 2:45 raise RuntimeError('Construction of "uniform_uncertain" class object requires at least 3 inputs.')46 47 61 # create the object from the input 48 62 else: 49 # leaving this here in case it becomes important in the future50 #asizec = array_size(*args[0:min(nargin, 3)])51 #uuv = [uniform_uncertain() for i in range(asizec[0]) for j in range(asizec[1])]52 63 uuv = uniform_uncertain() 53 uuv.descriptor = str(args[0]) 54 uuv.lower = args[1] 55 uuv.upper = args[2] 56 if (nargin > 3): 57 print('WARNING: uniform_uncertain:extra_arg: Extra arguments for object of class ' + type(uuv) + '.') 58 59 return [uuv] 60 61 def __repr__(self): 62 # display an individual object 63 string = '\n' 64 string += 'class "uniform_uncertain" object = \n' 65 string += ' descriptor: ' + str(self.descriptor) + '\n' 66 string += ' lower: ' + str(self.lower) + '\n' 67 string += ' upper: ' + str(self.upper) + '\n' 68 64 65 #recover options: 66 options = pairoptions(*args) 67 68 #initialize fields: 69 uuv.descriptor = options.getfieldvalue('descriptor', '') 70 uuv.lower = options.getfieldvalue('lower', -np.Inf) 71 uuv.upper = options.getfieldvalue('upper', np.Inf) 72 73 #if the variable is scaled, a partition vector should have been 74 #supplied, and that partition vector should have as many partitions as 75 #the lower and upper vectors: 76 if uuv.isscaled(): 77 uuv.partition = options.getfieldvalue('partition') 78 npart = partition_npart(uuv.partition) 79 if npart != len(uuv.upper): 80 raise RuntimeError("uniform_uncertain constructor: for the scaled variable %s the upper field is not currently a vector of values for all the partitions described in the partition vector" % uuv.descriptor) 81 if npart != len(uuv.lower): 82 raise RuntimeError("uniform_uncertain constructor: for the scaled variable %s the lower field is not currently a vector of values for all the partitions described in the partition vector" % uuv.descriptor) 83 84 return [uuv] # Always return a list, so we have something akin to a MATLAB single row matrix 85 86 def __repr__(self): #{{{ 87 string = ' uniform uncertain variable: ' 88 string = "%s\n%s" % (string, fielddisplay(self, 'descriptor', 'name tag')) 89 string = "%s\n%s" % (string, fielddisplay(self, 'lower', 'pdf lower bound')) 90 string = "%s\n%s" % (string, fielddisplay(self, 'upper', 'pdf upper bound')) 91 if self.partition != []: 92 string = "%s\n%s" % (string, fielddisplay(self, 'partition', 'partition vector defining where sampling will occur')) 69 93 return string 70 71 # from here on, uuv is either a single, or a 1d vector of, uniform_uncertain 72 73 @staticmethod 74 def prop_desc(uuv, dstr): 75 if type(uuv) not in [list, np.ndarray]: 76 if uuv.descriptor != '' or type(uuv.descriptor) != str: 77 desc = str(uuv.descriptor) 78 elif dstr != '': 79 desc = str(dstr) 80 else: 81 desc = 'uuv' 82 return desc 83 94 #}}} 95 96 def __len__(self): #{{{ 97 if type(self.lower) in [list, np.ndarray]: 98 return len(self.lower) 99 else: 100 return 1 101 #}}} 102 103 def checkconsistency(self, md, solution, analyses): #{{{ 104 md = checkfield(md, 'field', self.upper, 'fieldname', 'uniform_uncertain.upper', 'NaN', 1, 'Inf', 1, '>', self.lower, 'numel', len(self.lower)) 105 md = checkfield(md, 'field', self.lower, 'fieldname', 'uniform_uncertain.upper', 'NaN', 1, 'Inf', 1, '<', self.upper, 'numel', len(self.upper)) 106 if self.isscaled(): 107 if self.partition == []: 108 raise RuntimeError("uniform_uncertain is a scaled variable, but it's missing a partition vector") 109 #better have a partition vector that has as many partitions as upper and lower's size: 110 if len(self.upper) != partition_npart(self.partititon): 111 raise RuntimeError("uniform_uncertain error message: upper and partition should be vectors of identical size") 112 if len(self.lower) != partition_npart(self.partition): 113 raise RuntimeError("uniform_uncertain error message: lower and partition should be vectors of identical size") 114 md = checkfield(md, 'field', self.partition, 'fieldname', 'uniform_uncertain.partition', 'NaN', 1, 'Inf', 1, '>=', -1, 'numel', [md.mesh.numberofvertices, md.mesh.numberofvertices]) 115 if self.partition.shape[1] > 1: 116 raise RuntimeError("uniform_uncertain error message: partition should be a column vector") 117 partcheck = np.unique(self.partition) 118 partmin = min(partcheck) 119 partmax = max(partcheck) 120 if partmax < -1: 121 raise RuntimeError("uniform_uncertain error message: partition vector's min value should be -1 (for no partition), or start at 0") 122 nmax = max(md.mesh.numberofelements, md.mesh.numberofvertices) 123 if partmax > nmax: 124 raise RuntimeError("uniform_uncertain error message: partition vector's values cannot go over the number of vertices or elements") 125 #}}} 126 127 #virtual functions needed by qmu processing algorithms: 128 #implemented: 129 130 @staticmethod 131 def prop_desc(uuv, dstr): #{{{ 84 132 desc = ['' for i in range(np.size(uuv))] 85 133 for i in range(np.size(uuv)): … … 94 142 95 143 return desc 96 97 @staticmethod 98 def prop_initpt(uuv): 99 initpt = [] 100 return initpt 101 102 @staticmethod 103 def prop_lower(uuv): 144 #}}} 145 146 @staticmethod 147 def prop_lower(uuv): #{{{ 104 148 if type(uuv) not in [list, np.ndarray]: 105 return uuv.lower149 return [uuv.lower] 106 150 107 151 lower = np.zeros(np.size(uuv)) … … 112 156 113 157 return lower 114 115 @staticmethod 116 def prop_upper(uuv): 158 #}}} 159 160 @staticmethod 161 def prop_upper(uuv): #{{{ 117 162 if type(uuv) not in [list, np.ndarray]: 118 return uuv.upper163 return [uuv.upper] 119 164 120 165 upper = np.zeros(np.size(uuv)) … … 125 170 126 171 return upper 127 128 @staticmethod 129 def prop_mean(uuv): 172 #}}} 173 174 @staticmethod 175 def prop_stddev(uuv): #{{{ 176 stddev = [] 177 return stddev 178 #}}} 179 180 @staticmethod 181 def prop_mean(uuv): #{{{ 130 182 mean = [] 131 183 return mean 132 133 @staticmethod 134 def prop_stddev(uuv): 135 stddev = [] 136 return stddev 137 138 @staticmethod 139 def prop_initst(uuv): 184 #}}} 185 186 @staticmethod 187 def prop_initpt(uuv): #{{{ 188 initpt = [] 189 return initpt 190 #}}} 191 192 @staticmethod 193 def prop_initst(uuv): #{{{ 140 194 initst = [] 141 195 return initst 142 143 @staticmethod 144 def prop_stype(uuv): 196 #}}} 197 198 @staticmethod 199 def prop_stype(uuv): #{{{ 145 200 stype = [] 146 201 return stype 147 148 @staticmethod 149 def prop_scale(uuv): 202 #}}} 203 204 @staticmethod 205 def prop_scale(uuv): #{{{ 150 206 scale = [] 151 207 return scale 152 153 @staticmethod 154 def dakota_write(fidi, dvar): 155 # collect only the variables of the appropriate class 156 uuv = [struc_class(i, 'uniform_uncertain', 'uuv') for i in dvar] 208 #}}} 209 210 @staticmethod 211 def prop_abscissas(hbu): #{{{ 212 abscissas = [] 213 return abscissas 214 #}}} 215 216 @staticmethod 217 def prop_counts(hbu): #{{{ 218 counts = [] 219 return counts 220 #}}} 221 222 @staticmethod 223 def prop_pairs_per_variable(hbu): #{{{ 224 pairs_per_variable = [] 225 return pairs_per_variable 226 #}}} 227 228 #new methods: 229 def isscaled(self): #{{{ 230 if strncmp(self.descriptor, 'scaled_', 7): 231 return True 232 else: 233 return False 234 #}}} 235 236 @staticmethod 237 def dakota_write(fidi, dvar): #{{{ 157 238 # possible namespace pollution, the above import seems not to work 158 239 from vlist_write import vlist_write 159 # write variables 160 vlist_write(fidi, 'uniform_uncertain', 'uuv', uuv) 240 # # collect only the variables of the appropriate class 241 # uuv = [struc_class(i, 'uniform_uncertain', 'uuv') for i in dvar] 242 fields = fieldnames(dvar) 243 for field in fields: 244 if getattr(dvar, field)[0].__class__.__name__ != 'uniform_uncertain': 245 delattr(dvar, field) 246 if len(dvar) > 0: 247 vlist_write(fidi, 'uniform_uncertain', 'uuv', dvar) 248 #}}} -
issm/trunk-jpl/src/m/qmu/dakota_in_write.m
r23095 r24870 109 109 responses_write(fidi,dmeth,dresp,params); 110 110 111 112 111 fclose(fidi); 113 112 display('End of file successfully written.'); 113 114 % Uncomment to print contents of Dakota input file (for debugging) 115 % type([name ext]); 114 116 115 117 end … … 186 188 187 189 % variables vary by method 188 189 190 for i=1:length(dmeth.variables) 190 191 fhvar=str2func([dmeth.variables{i} '.dakota_write']); -
issm/trunk-jpl/src/m/qmu/dakota_in_write.py
r24213 r24870 94 94 print('End of file successfully written.') 95 95 96 # Uncomment to print contents of Dakota input file (for debugging) 97 # with open(filei2, 'r') as fidi: 98 # print(fidi.read()) 96 99 97 100 # function to write the strategy section of the file … … 153 156 def variables_write(fidi, dmeth, dvar): 154 157 158 # print('Writing variables section of Dakota input file.') 159 160 # fidi.write('variables, \n') 161 162 # # variables vary by method 163 # fd = fieldnames(dvar) 164 # types = [] 165 # var = [] 166 # for i in range(len(fd)): 167 # i_type = eval('dvar.{}[0].__class__.__name__'.format(fd[i])) 168 # j = dmeth.variables.index(i_type) 169 # str_name = dmeth.variables[j] 170 171 # # organize so that multiple instances of the same qmu class 172 # # (2 different variable instances of "normal_uncertain" for example) 173 # # are in the same dakota_write call regardless of individual size 174 # # but that each class has its own dakota_write call 175 # if str_name not in types: 176 # types.append(str_name) 177 # var.append(eval('dvar.{}'.format(fd[i]))) 178 # else: 179 # t = types.index(str_name) 180 # var[t].extend(eval('dvar.{}'.format(fd[i]))) 181 182 # for t in range(len(types)): 183 # v = eval('{}.{}()'.format(types[t], types[t])) 184 # v.dakota_write(fidi, var[t]) 185 186 # # linear constraints vary by method 187 # fc = dmeth.lcspec 188 189 # for i in range(len(dmeth.lcspec)): 190 # str_name = dmeth.lcspec[i] 191 # var = eval('{}.{}()'.format(str_name, str_name)) 192 # # check that str_name is correct against matlab version which has no argument there 193 # var.dakota_write(fidi, eval('dvar.{}[i]'.format(j)), str_name) 194 195 # fidi.write('\n') 196 155 197 print('Writing variables section of Dakota input file.') 156 198 157 199 fidi.write('variables, \n') 158 200 159 # variables vary by method 160 fd = fieldnames(dvar) 161 types = [] 162 var = [] 163 for i in range(len(fd)): 164 i_type = eval('dvar.{}[0].__class__.__name__'.format(fd[i])) 165 j = dmeth.variables.index(i_type) 166 str_name = dmeth.variables[j] 167 168 # organize so that multiple instances of the same qmu class 169 # (2 different variable instances of "normal_uncertain" for example) 170 # are in the same dakota_write call regardless of individual size 171 # but that each class has its own dakota_write call 172 if str_name not in types: 173 types.append(str_name) 174 var.append(eval('dvar.{}'.format(fd[i]))) 175 else: 176 t = types.index(str_name) 177 var[t].extend(eval('dvar.{}'.format(fd[i]))) 178 179 for t in range(len(types)): 180 v = eval('{}.{}()'.format(types[t], types[t])) 181 v.dakota_write(fidi, var[t]) 182 183 # linear constraints vary by method 184 fc = dmeth.lcspec 201 for i in range(len(dmeth.variables)): 202 str_name = dmeth.variables[i] 203 # TODO: Remove this check after continuous_state.py has been updated! 204 if str_name != 'continuous_state': 205 var = eval('{}.{}()'.format(str_name, str_name)) 206 var.dakota_write(fidi, dvar) 185 207 186 208 for i in range(len(dmeth.lcspec)): 187 209 str_name = dmeth.lcspec[i] 188 210 var = eval('{}.{}()'.format(str_name, str_name)) 189 # check that str_name is correct against matlab version which has no argument there190 var.dakota_write(fidi, eval('dvar.{}[i]'.format( j)), str_name)211 # check that str_name is correct against matlab version which has no argument there 212 var.dakota_write(fidi, eval('dvar.{}[i]'.format(str_name)), str_name) 191 213 192 214 fidi.write('\n') … … 275 297 276 298 rdesc = [] 277 278 299 for i in range(len(dmeth.responses)): 279 300 resp = eval(dmeth.responses[i]) -
issm/trunk-jpl/src/m/qmu/expandvariables.m
r24835 r24870 5 5 for i=1:length(fnames) 6 6 7 8 7 if isa(variables.(fnames{i}),'linear_inequality_constraint') || isa(variables.(fnames{i}),'linear_equality_constraint' ) 9 8 %for linear constraints, just copy -
issm/trunk-jpl/src/m/qmu/expandvariables.py
r24213 r24870 1 1 from QmuSetupVariables import * 2 2 from helpers import * 3 4 3 from qmu_classes import * 5 4 … … 13 12 14 13 for k in fnames: 15 v = eval('variables.{}'.format(k))14 v = getattr(variables, k) 16 15 17 16 # for linear constraints, just copy … … 24 23 for j in range(len(v)): 25 24 #call setupdesign 26 exec('dvar.{}=QmuSetupVariables(md, dvar.{},v[j])'.format(k, k))25 exec('dvar.{}=QmuSetupVariables(md, v[j])'.format(k, k)) 27 26 return dvar -
issm/trunk-jpl/src/m/qmu/helpers.py
r24254 r24870 176 176 177 177 def __delattr__(self, key): 178 if namenot in self._k:178 if key not in self._k: 179 179 raise AttributeError('Attribute "' + str(attr) + '" does not exist or is an internal field and therefore cannot be deleted safely.') 180 180 self.pop(key) -
issm/trunk-jpl/src/m/qmu/importancefactors.m
r24173 r24870 8 8 % Example: factors=importancefactors(md,'drag','max_vel'); 9 9 % 10 11 10 variablenamelength=length(variablename); 12 11 -
issm/trunk-jpl/src/m/qmu/importancefactors.py
r24241 r24870 10 10 11 11 Example: factors = importancefactors(md, 'drag', 'max_vel') 12 ''' 13 12 ''' 14 13 variablenamelength = len(variablename) 15 14 -
issm/trunk-jpl/src/m/qmu/preqmu.py
r24541 r24870 50 50 # go through variables and responses, and check they don't have more than 51 51 # md.qmu.numberofpartitions values. Also determine numvariables and numresponses 52 # [[[52 #{{{ 53 53 numvariables = 0 54 54 variable_fieldnames = fieldnames(variables) … … 57 57 fieldvariables = vars(variables)[field_name] 58 58 for j in range(np.size(fieldvariables)): 59 if strncmpi(fieldvariables[j].descriptor, '\'scaled_', 8) and str2int(fieldvariables[j].descriptor, 'last') > md.qmu.numberofpartitions: 60 raise RuntimeError('preqmu error message: one of the expanded variables has more values than the number of partitions (setup in md.qmu.numberofpartitions)') 61 59 if strncmpi(fieldvariables[j].descriptor, 'scaled_', 7): 60 npart = partition_npart(fieldvariables[j].partition) 61 if str2int(fieldvariables[j].descriptor, 'last') > npart: 62 raise RuntimeError('preqmu error message: one of the expanded variables has more values than the number of partitions (setup in md.qmu.numberofpartitions)') 62 63 numvariables = numvariables + np.size(vars(variables)[field_name]) 63 64 … … 68 69 fieldresponses = vars(responses)[field_name] 69 70 for j in range(np.size(fieldresponses)): 70 if strncmpi(fieldresponses[j].descriptor, '\'scaled_', 8) and str2int(fieldresponses[j].descriptor, 'last') > md.qmu.numberofpartitions: 71 raise RuntimeError('preqmu error message: one of the expanded responses has more values than the number of partitions (setup in md.qmu.numberofpartitions)') 72 71 if strncmpi(fieldresponses[j].descriptor, 'scaled_', 7): 72 npart = partition_npart(fieldresponses[j].partition) 73 if str2int(fieldresponses[j].descriptor, 'last') > md.qmu.numberofpartitions: 74 raise RuntimeError('preqmu error message: one of the expanded responses has more values than the number of partitions (setup in md.qmu.numberofpartitions)') 73 75 numresponses = numresponses + np.size(vars(responses)[field_name]) 74 75 #]]] 76 #}}} 76 77 77 78 # create in file for dakota -
issm/trunk-jpl/src/m/qmu/rlist_write.py
r24213 r24870 9 9 def rlist_write(fidi, cstring, cstring2, dresp, rdesc): 10 10 ''' 11 function to write response list 12 ''' 13 11 function to write response list 12 ''' 14 13 if dresp is None: 15 14 return … … 17 16 func = eval(cstring) 18 17 19 if type(dresp) not in [list, np.ndarray]:20 dresp = [dresp]18 # if type(dresp) not in [list, np.ndarray]: 19 # dresp = [dresp] 21 20 22 # put responses into lists for writing 23 # (and accumulate descriptors into list for subsequent writing) 21 fnames = fieldnames(dresp) 24 22 25 23 nresp = 0 … … 31 29 ptarget = [] 32 30 33 # assume all fields in dvar[0:n] are consistent (ex. all are normal_uncertain) 34 # which will always be true since this is called per field 35 fnames = fieldnames(dresp[0]) 36 for j in range(len(dresp)): 37 for i in range(np.size(fnames)): 38 nresp = nresp + np.size(vars(dresp[j])[fnames[i]]) 39 pstype.extend(func.prop_stype(vars(dresp[j])[fnames[i]])) 40 pscale.extend(func.prop_scale(vars(dresp[j])[fnames[i]])) 41 pweight.extend(func.prop_weight(vars(dresp[j])[fnames[i]])) 42 plower.extend(func.prop_lower(vars(dresp[j])[fnames[i]])) 43 pupper.extend(func.prop_upper(vars(dresp[j])[fnames[i]])) 44 ptarget.extend(func.prop_target(vars(dresp[j])[fnames[i]])) 45 rdesc.extend(func.prop_desc(vars(dresp[j])[fnames[i]], fnames[i])) 31 for i in range(len(fnames)): 32 field = getattr(dresp, format(fnames[i])) 33 nresp = nresp + len(field) 34 pstype.extend(func.prop_stype(field)) 35 pscale.extend(func.prop_scale(field)) 36 pweight.extend(func.prop_weight(field)) 37 plower.extend(func.prop_lower(field)) 38 pupper.extend(func.prop_upper(field)) 39 ptarget.extend(func.prop_target(field)) 40 rdesc.extend(func.prop_desc(field, field[0].descriptor)) 46 41 47 42 # write responses -
issm/trunk-jpl/src/m/qmu/setupdesign/QmuSetupVariables.m
r24836 r24870 23 23 %ok, dealing with semi-discrete distributed variable. Distribute according to how many 24 24 %partitions we want 25 26 25 for j=1:md.qmu.numberofpartitions 27 26 dvar(end+1) =variables; -
issm/trunk-jpl/src/m/qmu/setupdesign/QmuSetupVariables.py
r24213 r24870 1 1 from MatlabFuncs import * 2 from copy import deepcopy 3 from helpers import * 4 from normal_uncertain import * 2 5 from uniform_uncertain import * 3 from normal_uncertain import *4 from copy import deepcopy5 6 6 7 7 def QmuSetupVariables(md, dvar, variables): 8 8 def QmuSetupVariables(md, variables): 9 9 #get descriptor 10 10 descriptor = variables.descriptor … … 12 12 #decide whether this is a distributed variable, which will drive whether we expand it into npart values, 13 13 #or if we just carry it forward as is. 14 15 dvar = [] 14 16 15 17 #ok, key off according to type of descriptor: … … 19 21 if ((type(variables.lower) in [list, np.ndarray] and len(variables.lower) > md.qmu.numberofpartitions) or (type(variables.upper) in [list, np.ndarray] and len(variables.upper) > md.qmu.numberofpartitions)): 20 22 raise RuntimeError('QmuSetupDesign error message: upper and lower should be either a scalar or a "npart" length vector') 21 22 23 elif isinstance(variables, normal_uncertain): 23 24 if type(variables.stddev) in [list, np.ndarray] and len(variables.stddev) > md.qmu.numberofpartitions: 24 25 raise RuntimeError('QmuSetupDesign error message: stddev should be either a scalar or a "npart" length vector') 25 26 26 #ok, dealing with semi -discrete distributed variable. Distribute according to how many27 #ok, dealing with semi-discrete distributed variable. Distribute according to how many 27 28 #partitions we want 28 29 for j in range(md.qmu.numberofpartitions): 29 30 dvar.append(deepcopy(variables)) 30 # "'" is because qmu.in files need for strings to be in actual ''31 # must also account for whether we are given 1 instance or an array of instances32 # handle descriptors for everything33 if type(dvar[-1].descriptor) in [list, np.ndarray] and len(variables.descriptor) > 1 and len(variables.upper) != md.qmu.numberofpartitions:34 if type(variables.descriptor) == np.ndarray:35 dvar[-1].descriptor = np.append(dvar[-1].descriptor, "'" + str(variables.descriptor) + '_' + str(j + 1) + "'")36 else:37 dvar[-1].descriptor.append("'" + str(variables.descriptor) + '_' + str(j + 1) + "'")38 else:39 dvar[-1].descriptor = "'" + str(variables.descriptor) + '_' + str(j + 1) + "'"40 31 41 # handle uniform_uncertain 32 # text parsing in dakota requires literal "'identifier'" not just "identifier" 33 dvar[-1].descriptor = "'" + str(variables.descriptor) + '_' + str(j + 1) + "'" 34 42 35 if isinstance(variables, uniform_uncertain): 43 if type(variables.lower) in [list, np.ndarray] and len(variables.lower) > 1 and len(variables.upper) != md.qmu.numberofpartitions: 44 if type(variables.lower) == np.ndarray: 45 dvar[-1].lower = np.append(dvar[-1].lower, variables.lower[j]) 46 else: 47 dvar[-1].lower.append(variables.lower[j]) 36 if type(variables.lower) in [list, np.ndarray]: 37 dvar[-1].lower = variables.lower[j] 48 38 else: 49 39 dvar[-1].lower = variables.lower 50 51 if type(variables.upper) in [list, np.ndarray] and len(variables.upper) > 1 and len(variables.upper) != md.qmu.numberofpartitions: 52 if type(variables.upper) == np.ndarray: 53 dvar[-1].upper = np.append(dvar[-1].upper, variables.upper[j]) 54 else: 55 dvar[-1].upper.append(variables.upper[j]) 40 if type(variables.upper) in [list, np.ndarray]: 41 dvar[-1].upper = variables.upper[j] 56 42 else: 57 43 dvar[-1].upper = variables.upper 58 59 # handle normal_uncertain60 44 elif isinstance(variables, normal_uncertain): 61 if type(variables.stddev) in [list, np.ndarray] and len(variables.stddev) > 1 and len(variables.upper) != md.qmu.numberofpartitions: 62 if type(variables.stddev) == np.ndarray: 63 dvar[-1].stddev = np.append(dvar[-1].stddev, variables.stddev[j]) 64 else: 65 dvar[-1].stddev.append(variables.stddev[j]) 45 if type(variables.stddev) in [list, np.ndarray]: 46 dvar[-1].stddev = variables.stddev[j] 66 47 else: 67 48 dvar[-1].stddev = variables.stddev 49 if type(variables.mean) in [list, np.ndarray]: 50 dvar[-1].mean = variables.mean[j] 51 else: 52 dvar[-1].mean = variables.mean 53 else: 54 dvar.append(deepcopy(variables)) 68 55 69 # running with a single instance, and therefore length 1 arrays of qmu classes 70 else: 71 dvar.append(variables) 72 # text parsing in dakota requires literal "'identifier'" not just "identifier" 73 for v in dvar: 74 v.descriptor = "'" + str(v.descriptor) + "'" 56 # text parsing in dakota requires literal "'identifier'" not just "identifier" 57 dvar[-1].descriptor = "'" + str(variables.descriptor) + "'" 75 58 76 59 return dvar -
issm/trunk-jpl/src/m/qmu/vlist_write.m
r24438 r24870 7 7 return; 8 8 end 9 10 fnames=fieldnames(dvar); 9 11 10 12 % put variables into lists for writing … … 24 26 pdesc =[]; 25 27 26 fnames=fieldnames(dvar);27 28 for i=1:numel(fnames) 28 29 nvar=nvar+numel(dvar.(fnames{i})); -
issm/trunk-jpl/src/m/qmu/vlist_write.py
r24213 r24870 13 13 This is used for when both the input dvar and the 'cstring' variables have non - 1 length 14 14 ''' 15 16 15 if np.size(a) == l: 17 16 if p == 0: … … 41 40 if dvar is None: 42 41 return 43 #from uniform_uncertain import * 42 44 43 func = eval(cstring) 45 44 45 # if type(dvar) not in [list, np.ndarray]: 46 # dvar = [dvar] 47 48 fnames = fieldnames(dvar) 49 46 50 # put variables into lists for writing 47 48 if type(dvar) not in [list, np.ndarray]:49 dvar = [dvar]50 51 # assume all fields in dvar[0:n] are consistent (ex. all are normal_uncertain)52 # which will always be true since this vlist_write is called per field53 fnames = fieldnames(dvar[0])54 55 51 nvar = 0 56 pinitpt = [[] for i in range(len(fnames))] 57 plower = [[] for i in range(len(fnames))] 58 pupper = [[] for i in range(len(fnames))] 59 pmean = [[] for i in range(len(fnames))] 60 pstddev = [[] for i in range(len(fnames))] 61 pinitst = [[] for i in range(len(fnames))] 62 pstype = [[] for i in range(len(fnames))] 63 pscale = [[] for i in range(len(fnames))] 64 pdesc = [[] for i in range(len(fnames))] 52 pinitpt = [] 53 plower = [] 54 pupper = [] 55 pmean = [] 56 pstddev = [] 57 pinitst = [] 58 pstype = [] 59 pscale = [] 60 ppairs_per_variable = [] 61 pabscissas = [] 62 pcounts = [] 63 pdesc = [] 65 64 66 65 for i in range(len(fnames)): 67 nvar += len(dvar) 68 for j in dvar: 69 j = vars(j)[fnames[i]] 70 pinitpt[i].extend(check(func.prop_initpt(j), len(dvar), len(pinitpt[i]))) 71 plower[i].extend(check(func.prop_lower(j), len(dvar), len(plower[i]))) 72 pupper[i].extend(check(func.prop_upper(j), len(dvar), len(pupper[i]))) 73 pmean[i].extend(check(func.prop_mean(j), len(dvar), len(pmean[i]))) 74 pstddev[i].extend(check(func.prop_stddev(j), len(dvar), len(pstddev[i]))) 75 pinitst[i].extend(check(func.prop_initst(j), len(dvar), len(pinitst[i]))) 76 pstype[i].extend(check(func.prop_stype(j), len(dvar), len(pstype[i]))) 77 pscale[i].extend(check(func.prop_scale(j), len(dvar), len(pscale[i]))) 78 pdesc[i].extend(check(func.prop_desc(j, fnames[i]), len(dvar), len(pdesc[i]))) 66 field = getattr(dvar, format(fnames[i])) 67 nvar = nvar + len(field) 68 pinitpt.extend(func.prop_initpt(field)) 69 plower.extend(func.prop_lower(field)) 70 pupper.extend(func.prop_upper(field)) 71 pmean.extend(func.prop_mean(field)) 72 pstddev.extend(func.prop_stddev(field)) 73 pinitst.extend(func.prop_initst(field)) 74 pstype.extend(func.prop_stype(field)) 75 pscale.extend(func.prop_scale(field)) 76 ppairs_per_variable.extend(func.prop_pairs_per_variable(field)) 77 pabscissas.extend(func.prop_abscissas(field)) 78 pcounts.extend(func.prop_counts(field)) 79 pdesc.extend(func.prop_desc(field, field[0].descriptor)) 79 80 80 81 pinitpt = allempty(pinitpt) … … 86 87 pstype = allempty(pstype) 87 88 pscale = allempty(pscale) 89 ppairs_per_variable = allempty(ppairs_per_variable) 90 pabscissas = allempty(pabscissas) 91 pcounts = allempty(pcounts) 88 92 pdesc = allempty(pdesc) 89 93 … … 124 128 vector_write(fidi, '\t ', pscale, 6, 76) 125 129 130 if not isempty(ppairs_per_variable): 131 fidi.write('\t ' + cstring2 + '_pairs_per_variable =\n') 132 vector_write(fidi, '\t ', ppairs_per_variable, 6, 76) 133 134 if not isempty(pabscissas): 135 fidi.write('\t ' + cstring2 + '_abscissas =\n') 136 vector_write(fidi, '\t ', pabscissas, 6, 76) 137 138 if not isempty(pcounts): 139 fidi.write('\t ' + cstring2 + '_counts =\n') 140 vector_write(fidi, '\t ', pcounts, 6, 76) 141 126 142 if not isempty(pdesc): 127 fidi.write('\t ' + cstring2 + '_descriptors =\n')143 fidi.write('\t ' + 'descriptors =\n') 128 144 vector_write(fidi, '\t ', pdesc, 6, 76) 129 145 -
issm/trunk-jpl/test/NightlyRun/test218.py
r24261 r24870 84 84 85 85 #variables 86 md.qmu.variables.rheology_B = normal_uncertain.normal_uncertain('scaled_MaterialsRheologyB', 1, .05) 86 md.qmu.variables.rheology_B = normal_uncertain.normal_uncertain( 87 'descriptor', 'scaled_MaterialsRheologyB', 88 'mean', np.ones(md.mesh.numberofvertices), 89 'stddev', .05 * np.ones(md.mesh.numberofvertices), 90 'partition', md.qmu.vpartition 91 ) 87 92 88 93 #responses 89 md.qmu.responses.MaxVel = response_function.response_function(' MaxVel', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])94 md.qmu.responses.MaxVel = response_function.response_function('descriptor', 'MaxVel') 90 95 91 96 #method -
issm/trunk-jpl/test/NightlyRun/test234.py
r24384 r24870 43 43 44 44 #variables 45 md.qmu.variables.surface_mass_balance = normal_uncertain.normal_uncertain('scaled_SmbMassBalance', 1, 0.1) 45 md.qmu.variables.surface_mass_balance = normal_uncertain.normal_uncertain( 46 'descriptor', 'scaled_SmbMassBalance', 47 'mean', np.ones(md.qmu.numberofpartitions), 48 'stddev', .1 * np.ones(md.qmu.numberofpartitions), 49 'partition', md.qmu.vpartition 50 ) 46 51 47 52 #responses 48 md.qmu.responses.MaxVel = response_function.response_function(' MaxVel', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])49 md.qmu.responses.IceVolume = response_function.response_function(' IceVolume', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])50 md.qmu.responses.MassFlux1 = response_function.response_function(' indexed_MassFlux_1', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])51 md.qmu.responses.MassFlux2 = response_function.response_function(' indexed_MassFlux_2', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])52 md.qmu.responses.MassFlux3 = response_function.response_function(' indexed_MassFlux_3', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])53 md.qmu.responses.MassFlux4 = response_function.response_function(' indexed_MassFlux_4', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])54 md.qmu.responses.MassFlux5 = response_function.response_function(' indexed_MassFlux_5', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])55 md.qmu.responses.massFlux6 = response_function.response_function(' indexed_MassFlux_6', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])53 md.qmu.responses.MaxVel = response_function.response_function('descriptor','MaxVel') 54 md.qmu.responses.IceVolume = response_function.response_function('descriptor','IceVolume') 55 md.qmu.responses.MassFlux1 = response_function.response_function('descriptor','indexed_MassFlux_1') 56 md.qmu.responses.MassFlux2 = response_function.response_function('descriptor','indexed_MassFlux_2') 57 md.qmu.responses.MassFlux3 = response_function.response_function('descriptor','indexed_MassFlux_3') 58 md.qmu.responses.MassFlux4 = response_function.response_function('descriptor','indexed_MassFlux_4') 59 md.qmu.responses.MassFlux5 = response_function.response_function('descriptor','indexed_MassFlux_5') 60 md.qmu.responses.massFlux6 = response_function.response_function('descriptor','indexed_MassFlux_6') 56 61 57 62 #mass flux profiles -
issm/trunk-jpl/test/NightlyRun/test244.py
r24261 r24870 73 73 74 74 #variables 75 md.qmu.variables.surface_mass_balanceC = normal_uncertain.normal_uncertain('scaled_SmbC', 1, 0.5) 75 md.qmu.variables.surface_mass_balance = normal_uncertain.normal_uncertain( 76 'descriptor', 'scaled_SmbC', 77 'mean', np.ones(md.qmu.numberofpartitions), 78 'stddev', .5 * np.ones(md.qmu.numberofpartitions), 79 'partition', md.qmu.epartition 80 ) 76 81 Tmin = 273. 77 82 telms = np.atleast_2d(np.min(md.smb.Ta[0:-1, :], 1)) … … 85 90 86 91 mint_on_partition[np.where(np.isnan(mint_on_partition))] = 10**-10 87 md.qmu.variables.surface_mass_balanceTa = uniform_uncertain.uniform_uncertain('scaled_SmbTa', 1, 0.05) 88 md.qmu.variables.surface_mass_balanceTa[0].lower = 0.95 89 md.qmu.variables.surface_mass_balanceTa[0].upper = np.maximum(np.minimum(np.maximum(1.05, mint_on_partition), 0.9999), 0.0001) 92 md.qmu.variables.surface_mass_balanceTa = uniform_uncertain.uniform_uncertain( 93 'descriptor', 'scaled_SmbTa', 94 'lower', .95 * np.ones(md.qmu.numberofpartitions), 95 'upper', np.maximum(np.minimum(np.maximum(1.05, mint_on_partition), 0.9999), 0.0001), 96 'partition', md.qmu.epartition 97 ) 90 98 91 99 #responses 92 md.qmu.responses.IceVolume = response_function.response_function(' IceVolume', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])93 md.qmu.responses.IceMass = response_function.response_function(' IceMass', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])94 md.qmu.responses.TotalSmb = response_function.response_function(' TotalSmb', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])100 md.qmu.responses.IceVolume = response_function.response_function('descriptor','IceVolume') 101 md.qmu.responses.IceMass = response_function.response_function('descriptor','IceMass') 102 md.qmu.responses.TotalSmb = response_function.response_function('descriptor','TotalSmb') 95 103 96 104 # nond_sampling study -
issm/trunk-jpl/test/NightlyRun/test250.py
r24384 r24870 41 41 42 42 #variables 43 md.qmu.variables.surface_mass_balance = normal_uncertain.normal_uncertain('scaled_SmbMassBalance', 1, 0.1) 43 md.qmu.variables.surface_mass_balance = normal_uncertain.normal_uncertain( 44 'descriptor', 'scaled_SmbMassBalance', 45 'mean', np.ones(md.qmu.numberofpartitions), 46 'stddev', .1 * np.ones(md.qmu.numberofpartitions), 47 'partition', md.qmu.vpartition 48 ) 44 49 45 50 #responses 46 md.qmu.responses.MaxVel = response_function.response_function(' MaxVel', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])47 md.qmu.responses.IceVolume = response_function.response_function(' IceVolume', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])48 md.qmu.responses.MassFlux1 = response_function.response_function(' indexed_MassFlux_1', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])49 md.qmu.responses.MassFlux2 = response_function.response_function(' indexed_MassFlux_2', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])50 md.qmu.responses.MassFlux3 = response_function.response_function(' indexed_MassFlux_3', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])51 md.qmu.responses.MassFlux4 = response_function.response_function(' indexed_MassFlux_4', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])52 md.qmu.responses.MassFlux5 = response_function.response_function(' indexed_MassFlux_5', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])53 md.qmu.responses.massFlux6 = response_function.response_function(' indexed_MassFlux_6', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])51 md.qmu.responses.MaxVel = response_function.response_function('descriptor','MaxVel') 52 md.qmu.responses.IceVolume = response_function.response_function('descriptor','IceVolume') 53 md.qmu.responses.MassFlux1 = response_function.response_function('descriptor','indexed_MassFlux_1') 54 md.qmu.responses.MassFlux2 = response_function.response_function('descriptor','indexed_MassFlux_2') 55 md.qmu.responses.MassFlux3 = response_function.response_function('descriptor','indexed_MassFlux_3') 56 md.qmu.responses.MassFlux4 = response_function.response_function('descriptor','indexed_MassFlux_4') 57 md.qmu.responses.MassFlux5 = response_function.response_function('descriptor','indexed_MassFlux_5') 58 md.qmu.responses.massFlux6 = response_function.response_function('descriptor','indexed_MassFlux_6') 54 59 55 60 #mass flux profiles -
issm/trunk-jpl/test/NightlyRun/test251.py
r24384 r24870 42 42 43 43 #variables 44 md.qmu.variables.surface_mass_balance = normal_uncertain.normal_uncertain('scaled_SmbMassBalance', 1, 100) 44 md.qmu.variables.surface_mass_balance = normal_uncertain.normal_uncertain( 45 'descriptor', 'scaled_SmbMassBalance', 46 'mean', np.ones(md.qmu.numberofpartitions), 47 'stddev', 100 * np.ones(md.qmu.numberofpartitions), 48 'partition', md.qmu.vpartition 49 ) 45 50 46 51 #responses 47 md.qmu.responses.MaxVel = response_function.response_function(' MaxVel', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])48 md.qmu.responses.IceVolume = response_function.response_function(' IceVolume', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])49 md.qmu.responses.MassFlux1 = response_function.response_function(' indexed_MassFlux_1', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])50 md.qmu.responses.MassFlux2 = response_function.response_function(' indexed_MassFlux_2', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])51 md.qmu.responses.MassFlux3 = response_function.response_function(' indexed_MassFlux_3', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])52 md.qmu.responses.MassFlux4 = response_function.response_function(' indexed_MassFlux_4', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])53 md.qmu.responses.MassFlux5 = response_function.response_function(' indexed_MassFlux_5', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])54 md.qmu.responses.massFlux6 = response_function.response_function(' indexed_MassFlux_6', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])52 md.qmu.responses.MaxVel = response_function.response_function('descriptor','MaxVel') 53 md.qmu.responses.IceVolume = response_function.response_function('descriptor','IceVolume') 54 md.qmu.responses.MassFlux1 = response_function.response_function('descriptor','indexed_MassFlux_1') 55 md.qmu.responses.MassFlux2 = response_function.response_function('descriptor','indexed_MassFlux_2') 56 md.qmu.responses.MassFlux3 = response_function.response_function('descriptor','indexed_MassFlux_3') 57 md.qmu.responses.MassFlux4 = response_function.response_function('descriptor','indexed_MassFlux_4') 58 md.qmu.responses.MassFlux5 = response_function.response_function('descriptor','indexed_MassFlux_5') 59 md.qmu.responses.massFlux6 = response_function.response_function('descriptor','indexed_MassFlux_6') 55 60 56 61 #mass flux profiles -
issm/trunk-jpl/test/NightlyRun/test412.m
r24839 r24870 11 11 md.qmu.vpartition=md.qmu.vpartition-1; 12 12 md.qmu.isdakota=1; 13 14 13 15 14 %Dakota options -
issm/trunk-jpl/test/NightlyRun/test412.py
r24261 r24870 31 31 32 32 #variables 33 md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain('MaterialsRhoIce', md.materials.rho_ice, 0.01) 34 md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain('scaled_FrictionCoefficient', 1, 0.01) 33 md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain( 34 'descriptor', 'MaterialsRhoIce', 35 'mean', md.materials.rho_ice, 36 'stddev', .01 37 ) 38 md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain( 39 'descriptor', 'scaled_FrictionCoefficient', 40 'mean', np.ones(md.mesh.numberofvertices), 41 'stddev', .01 * np.ones(md.mesh.numberofvertices), 42 'partition', md.qmu.vpartition 43 ) 35 44 36 45 #responses 37 md.qmu.responses.MaxVel = response_function.response_function(' MaxVel', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])46 md.qmu.responses.MaxVel = response_function.response_function('descriptor','MaxVel') 38 47 39 48 #method -
issm/trunk-jpl/test/NightlyRun/test413.py
r24261 r24870 28 28 29 29 #variables 30 md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain('MaterialsRhoIce', md.materials.rho_ice, 0.01) 31 md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain('scaled_FrictionCoefficient', 1, 0.01) 30 md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain( 31 'descriptor', 'MaterialsRhoIce', 32 'mean', md.materials.rho_ice, 33 'stddev', 0.1 34 ) 35 md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain( 36 'descriptor', 'scaled_FrictionCoefficient', 37 'mean', np.ones(md.qmu.numberofpartitions), 38 'stddev', .01 * np.ones(md.qmu.numberofpartitions), 39 'partition', md.qmu.vpartition 40 ) 32 41 33 42 #responses 34 md.qmu.responses.MaxVel = response_function.response_function(' MaxVel', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])43 md.qmu.responses.MaxVel = response_function.response_function('descriptor','MaxVel') 35 44 36 45 #method -
issm/trunk-jpl/test/NightlyRun/test414.py
r24261 r24870 37 37 38 38 #variables 39 md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain('scaled_FrictionCoefficient', 1, 0.01) 39 md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain( 40 'descriptor', 'scaled_FrictionCoefficient', 41 'mean', np.ones(md.qmu.numberofpartitions), 42 'stddev', .01 * np.ones(md.qmu.numberofpartitions), 43 'partition', md.qmu.vpartition 44 ) 40 45 41 46 #responses 42 md.qmu.responses.MaxVel = response_function.response_function('MaxVel', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 43 md.qmu.responses.MassFlux1 = response_function.response_function('indexed_MassFlux_1', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 44 md.qmu.responses.MassFlux2 = response_function.response_function('indexed_MassFlux_2', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 45 md.qmu.responses.MassFlux3 = response_function.response_function('indexed_MassFlux_3', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 46 md.qmu.responses.MassFlux4 = response_function.response_function('indexed_MassFlux_4', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 47 md.qmu.responses.MassFlux5 = response_function.response_function('indexed_MassFlux_5', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 48 md.qmu.responses.MassFlux6 = response_function.response_function('indexed_MassFlux_6', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 49 md.qmu.responses.MassFlux7 = response_function.response_function('indexed_MassFlux_7', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 47 md.qmu.responses.MaxVel = response_function.response_function('descriptor','MaxVel') 48 md.qmu.responses.IceVolume = response_function.response_function('descriptor','IceVolume') 49 md.qmu.responses.MassFlux1 = response_function.response_function('descriptor','indexed_MassFlux_1') 50 md.qmu.responses.MassFlux2 = response_function.response_function('descriptor','indexed_MassFlux_2') 51 md.qmu.responses.MassFlux3 = response_function.response_function('descriptor','indexed_MassFlux_3') 52 md.qmu.responses.MassFlux4 = response_function.response_function('descriptor','indexed_MassFlux_4') 53 md.qmu.responses.MassFlux5 = response_function.response_function('descriptor','indexed_MassFlux_5') 54 md.qmu.responses.massFlux6 = response_function.response_function('descriptor','indexed_MassFlux_6') 55 md.qmu.responses.massFlux7 = response_function.response_function('descriptor','indexed_MassFlux_7') 50 56 51 57 #mass flux profiles -
issm/trunk-jpl/test/NightlyRun/test417.py
r24261 r24870 37 37 38 38 #variables 39 md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain('scaled_FrictionCoefficient', 1, 0.01) 39 md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain( 40 'descriptor', 'scaled_FrictionCoefficient', 41 'mean', np.ones(md.qmu.numberofpartitions), 42 'stddev', .01 * np.ones(md.qmu.numberofpartitions), 43 'partition', md.qmu.vpartition 44 ) 40 45 41 46 #responses 42 md.qmu.responses.MaxVel = response_function.response_function('MaxVel', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 43 md.qmu.responses.MassFlux1 = response_function.response_function('indexed_MassFlux_1', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 44 md.qmu.responses.MassFlux2 = response_function.response_function('indexed_MassFlux_2', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 45 md.qmu.responses.MassFlux3 = response_function.response_function('indexed_MassFlux_3', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 46 md.qmu.responses.MassFlux4 = response_function.response_function('indexed_MassFlux_4', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 47 md.qmu.responses.MassFlux5 = response_function.response_function('indexed_MassFlux_5', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 48 md.qmu.responses.MassFlux6 = response_function.response_function('indexed_MassFlux_6', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 49 md.qmu.responses.MassFlux7 = response_function.response_function('indexed_MassFlux_7', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 47 md.qmu.responses.MaxVel = response_function.response_function('descriptor','MaxVel') 48 md.qmu.responses.IceVolume = response_function.response_function('descriptor','IceVolume') 49 md.qmu.responses.MassFlux1 = response_function.response_function('descriptor','indexed_MassFlux_1') 50 md.qmu.responses.MassFlux2 = response_function.response_function('descriptor','indexed_MassFlux_2') 51 md.qmu.responses.MassFlux3 = response_function.response_function('descriptor','indexed_MassFlux_3') 52 md.qmu.responses.MassFlux4 = response_function.response_function('descriptor','indexed_MassFlux_4') 53 md.qmu.responses.MassFlux5 = response_function.response_function('descriptor','indexed_MassFlux_5') 54 md.qmu.responses.massFlux6 = response_function.response_function('descriptor','indexed_MassFlux_6') 55 md.qmu.responses.massFlux7 = response_function.response_function('descriptor','indexed_MassFlux_7') 50 56 51 57 #mass flux profiles -
issm/trunk-jpl/test/NightlyRun/test420.py
r24261 r24870 29 29 30 30 #variables 31 md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain('MaterialsRhoIce', md.materials.rho_ice, 0.01) 31 md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain( 32 'descriptor', 'MaterialsRhoIce', 33 'mean', 1, 34 'stddev', .01 35 ) 32 36 33 37 #responses 34 md.qmu.responses.MaxVel = response_function.response_function('scaled_Thickness', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 38 md.qmu.responses.MaxVel = response_function.response_function( 39 'descriptor', 'scaled_Thickness', 40 'partition', md.qmu.vpartition 41 ) 35 42 36 43 #method -
issm/trunk-jpl/test/NightlyRun/test440.py
r24261 r24870 30 30 31 31 #variables 32 md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain('MaterialsRhoIce', md.materials.rho_ice, 0.01) 32 md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain( 33 'descriptor', 'MaterialsRhoIce', 34 'mean', 1, 35 'stddev', 0.01 36 ) 33 37 34 38 #responses 35 md.qmu.responses.MaxVel = response_function.response_function('scaled_Thickness', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999]) 39 md.qmu.responses.MaxVel = response_function.response_function( 40 'descriptor', 'scaled_Thickness', 41 'partition', md.qmu.vpartition 42 ) 36 43 37 44 #method -
issm/trunk-jpl/test/NightlyRun/test444.py
r24862 r24870 65 65 version = float(version[0]) 66 66 67 #partitioning 68 md.qmu.numberofpartitions = 10 69 md = partitioner(md, 'package', 'chaco', 'npart', md.qmu.numberofpartitions, 'weighting', 'on') 70 md.qmu.vpartition = md.qmu.vpartition - 1 71 md.qmu.isdakota = 1 72 67 73 #variables 68 md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain('scaled_BasalforcingsFloatingiceMeltingRate', 1, 0.1) 74 md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain( 75 'descriptor', 'scaled_BasalforcingsFloatingiceMeltingRate', 76 'mean', np.ones(md.qmu.numberofpartitions), 77 'stddev', .1 * np.ones(md.qmu.numberofpartitions), 78 'partition', md.qmu.vpartition 79 ) 80 69 81 70 82 #responses 71 md.qmu.responses.IceMass1 = response_function.response_function(' Outputdefinition5', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])72 md.qmu.responses.IceVolume1 = response_function.response_function(' Outputdefinition6', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])73 md.qmu.responses.IceVolumeAboveFloatation1 = response_function.response_function(' Outputdefinition7', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])74 md.qmu.responses.IceVolumeAboveFloatation = response_function.response_function(' IceVolumeAboveFloatation', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])75 md.qmu.responses.GroundedArea1 = response_function.response_function(' Outputdefinition1', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])76 md.qmu.responses.FloatingArea1 = response_function.response_function(' Outputdefinition2', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])77 md.qmu.responses.TotalFloatingBmb1 = response_function.response_function(' Outputdefinition3', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])78 md.qmu.responses.TotalGroundedBmb1 = response_function.response_function(' Outputdefinition4', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])79 md.qmu.responses.TotalSmb1 = response_function.response_function(' Outputdefinition8', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])80 md.qmu.responses.TotalSmb2 = response_function.response_function(' Outputdefinition9', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])81 md.qmu.responses.FloatingArea = response_function.response_function(' FloatingArea', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])83 md.qmu.responses.IceMass1 = response_function.response_function('descriptor','Outputdefinition5') 84 md.qmu.responses.IceVolume1 = response_function.response_function('descriptor','Outputdefinition6') 85 md.qmu.responses.IceVolumeAboveFloatation1 = response_function.response_function('descriptor','Outputdefinition7') 86 md.qmu.responses.IceVolumeAboveFloatation = response_function.response_function('descriptor','IceVolumeAboveFloatation') 87 md.qmu.responses.GroundedArea1 = response_function.response_function('descriptor','Outputdefinition1') 88 md.qmu.responses.FloatingArea1 = response_function.response_function('descriptor','Outputdefinition2') 89 md.qmu.responses.TotalFloatingBmb1 = response_function.response_function('descriptor','Outputdefinition3') 90 md.qmu.responses.TotalGroundedBmb1 = response_function.response_function('descriptor','Outputdefinition4') 91 md.qmu.responses.TotalSmb1 = response_function.response_function('descriptor','Outputdefinition8') 92 md.qmu.responses.TotalSmb2 = response_function.response_function('descriptor','Outputdefinition9') 93 md.qmu.responses.FloatingArea = response_function.response_function('descriptor','FloatingArea') 82 94 83 95 #method -
issm/trunk-jpl/test/NightlyRun/test445.m
r24839 r24870 29 29 'stddev',.05*ones(md.qmu.numberofpartitions,1),... 30 30 'partition',md.qmu.vpartition); 31 md.qmu.variables. neff=normal_uncertain('descriptor','scaled_BasalforcingsGeothermalflux',...31 md.qmu.variables.geoflux=normal_uncertain('descriptor','scaled_BasalforcingsGeothermalflux',... 32 32 'mean',ones(md.qmu.numberofpartitions,1),... 33 33 'stddev',.05*ones(md.qmu.numberofpartitions,1),... -
issm/trunk-jpl/test/NightlyRun/test445.py
r24261 r24870 34 34 version = float(version[0]) 35 35 36 #partitioning 37 md.qmu.numberofpartitions = 10 38 md = partitioner(md, 'package', 'chaco', 'npart', md.qmu.numberofpartitions, 'weighting', 'on') 39 md.qmu.vpartition = md.qmu.vpartition - 1 40 md.qmu.isdakota = 1 41 36 42 #variables 37 md.qmu.variables.neff = normal_uncertain.normal_uncertain('scaled_FrictionEffectivePressure', 1, .05) 38 md.qmu.variables.geoflux = normal_uncertain.normal_uncertain('scaled_BasalforcingsGeothermalflux', 1, .05) 43 md.qmu.variables.neff = normal_uncertain.normal_uncertain( 44 'descriptor', 'scaled_FrictionEffectivePressure', 45 'mean', np.ones(md.qmu.numberofpartitions), 46 'stddev', .05 * np.ones(md.qmu.numberofpartitions), 47 'partition', md.qmu.vpartition 48 ) 49 md.qmu.variables.geoflux = normal_uncertain.normal_uncertain( 50 'descriptor', 'scaled_BasalforcingsGeothermalflux', 51 'mean', np.ones(md.qmu.numberofpartitions), 52 'stddev', .05 * np.ones(md.qmu.numberofpartitions), 53 'partition', md.qmu.vpartition 54 ) 39 55 40 56 #responses 41 md.qmu.responses.MaxVel = response_function.response_function(' MaxVel', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])42 md.qmu.responses.MassFlux1 = response_function.response_function(' indexed_MassFlux_1', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])43 md.qmu.responses.MassFlux2 = response_function.response_function(' indexed_MassFlux_2', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])44 md.qmu.responses.MassFlux3 = response_function.response_function(' indexed_MassFlux_3', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])45 md.qmu.responses.MassFlux4 = response_function.response_function(' indexed_MassFlux_4', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])46 md.qmu.responses.MassFlux5 = response_function.response_function(' indexed_MassFlux_5', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])47 md.qmu.responses. MassFlux6 = response_function.response_function('indexed_MassFlux_6', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])48 md.qmu.responses. MassFlux7 = response_function.response_function('indexed_MassFlux_7', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])57 md.qmu.responses.MaxVel = response_function.response_function('descriptor','MaxVel') 58 md.qmu.responses.MassFlux1 = response_function.response_function('descriptor','indexed_MassFlux_1') 59 md.qmu.responses.MassFlux2 = response_function.response_function('descriptor','indexed_MassFlux_2') 60 md.qmu.responses.MassFlux3 = response_function.response_function('descriptor','indexed_MassFlux_3') 61 md.qmu.responses.MassFlux4 = response_function.response_function('descriptor','indexed_MassFlux_4') 62 md.qmu.responses.MassFlux5 = response_function.response_function('descriptor','indexed_MassFlux_5') 63 md.qmu.responses.massFlux6 = response_function.response_function('descriptor','indexed_MassFlux_6') 64 md.qmu.responses.massFlux7 = response_function.response_function('descriptor','indexed_MassFlux_7') 49 65 50 66 #mass flux profiles
Note:
See TracChangeset
for help on using the changeset viewer.