Changeset 316e231 in sasview
- Timestamp:
- May 3, 2012 11:23:15 AM (13 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 56acb5d
- Parents:
- 74d7b59
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/model_editor.py
r41a8cb3 r316e231 324 324 elif line.count("self.description = '%s'"): 325 325 out_f.write(line % description + "\n") 326 elif line.count("self.name = '%s'"):327 out_f.write(line % name + "\n")326 #elif line.count("self.name = '%s'"): 327 # out_f.write(line % name + "\n") 328 328 else: 329 329 out_f.write(line + "\n") … … 690 690 if has_scipy: 691 691 out_f.write("import scipy" + "\n") 692 elif line.count("name = "):693 out_f.write(line % self.name + "\n")692 #elif line.count("name = "): 693 # out_f.write(line % self.name + "\n") 694 694 elif line: 695 695 out_f.write(line + "\n") … … 777 777 from sans.models.pluginmodel import Model1DPlugin 778 778 from math import * 779 import os 780 import sys 779 781 import numpy 780 782 #import scipy? 781 783 class Model(Model1DPlugin): 782 name = " %s"784 name = "" 783 785 def __init__(self): 784 Model1DPlugin.__init__(self, name=self.name) 786 Model1DPlugin.__init__(self, name=self.name) 787 #set name same as file name 788 self.name = self.get_fname() 785 789 #self.params here 786 790 self.description = "%s" … … 827 831 """ 828 832 TEST_TEMPLATE = """ 833 def get_fname(self): 834 path = sys._getframe().f_code.co_filename 835 basename = os.path.basename(path) 836 name, _ = os.path.splitext(basename) 837 return name 829 838 ###################################################################### 830 839 ## THIS IS FOR TEST. DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! … … 854 863 #P2_model: 855 864 from sans.models.%s import %s as P2 865 import os 866 import sys 856 867 857 868 class Model(Model1DPlugin): … … 863 874 ## Setting model name model description 864 875 self.description = '%s' 865 self.name = '%s'876 self.name = self.get_fname() 866 877 if self.name.rstrip().lstrip() == '': 867 878 self.name = self._get_name(p_model1.name, p_model2.name) … … 1118 1129 ( p_model1.name, p_model2.name ) 1119 1130 self.description += description 1120 1131 1132 def get_fname(self): 1133 path = sys._getframe().f_code.co_filename 1134 basename = os.path.basename(path) 1135 name, _ = os.path.splitext(basename) 1136 return name 1137 1121 1138 if __name__ == "__main__": 1122 1139 m1= Model() -
fittingview/src/sans/perspectives/fitting/plugin_models/polynominal5.py
r19e614a r316e231 20 20 import math ##DO NOT CHANGE THIS LINE!!! 21 21 import numpy ##DO NOT CHANGE THIS LINE!!! 22 22 import os 23 import sys 23 24 ## <----- SIGN DEFINES WHERE YOU CAN MODIFY THE CODE 24 25 … … 30 31 ##EXAMPLE: Class that evaluates a polynomial model. 31 32 """ 32 ## YOU CAN MODIFY THE LINE BELLOW. CHANGE ONLY WORDS BETWEEN " " 33 ## TO RENAME YOUR MODEL: THIS NAME IS WHAT YOU SEE ON GUI. 34 name = "polynomial5" ## <----- FILE NAME (NAME OF THE MODEL) 33 name = "" 35 34 36 35 def __init__(self): ##DO NOT CHANGE THIS LINE!!! … … 48 47 self.params['E'] = 0.0 ## <----- 49 48 self.params['F'] = 0.0 ## <----- 49 # Set the name same as the file name 50 self.name = self.get_fname() ##DO NOT CHANGE THIS LINE!!! 50 51 ## YOU CAN MODIFY THE LINE BELLOW.MODIFY WORDS BETWEEN """ """ ONLY!!!! 51 52 self.description = """ … … 88 89 89 90 return result ## MODIFY ONLY RESULT. DON'T DELETE RETURN!!!! 90 91 92 ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! 93 def get_fname(self): 94 """ 95 Get the model name same as the file name 96 """ 97 path = sys._getframe().f_code.co_filename 98 basename = os.path.basename(path) 99 name, _ = os.path.splitext(basename) 100 return name 101 91 102 ############################################################################### 92 103 ## THIS IS FOR TEST. DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! -
fittingview/src/sans/perspectives/fitting/plugin_models/sph_bessel_jn.py
r19e614a r316e231 19 19 import numpy ##DO NOT CHANGE THIS LINE!!! 20 20 import scipy.special ##CHANGE THIS LINE WITH CAUTION!!! 21 21 import os 22 import sys 22 23 ##PLEASE READ COMMENTS CAREFULLY !!! COMMENT ARE IN CAPITAL LETTERS AND AFTER ## 23 24 ## THESE COMMENTS ARE THERE TO GUIDE YOU. YOU CAN REMOVE THEM ONLY WHEN YOU ARE … … 34 35 ##EXAMPLE: Class that evaluates a polynomial model. 35 36 """ 36 ## YOU CAN MODIFY THE LINE BELLOW. CHANGE ONLY WORDS BETWEEN " " 37 ## TO RENAME YOUR MODEL 38 name = "sph_bessel_jn" ## <----- FILE NAME (NAME OF THE MODEL) 37 name = "" 39 38 40 39 def __init__(self): ##DO NOT CHANGE THIS LINE!!! … … 47 46 ## DELETE MODIFIABLE LINE HERE WILL REDUCE THE NUMBER OF PARAMETERS 48 47 self.params = {} ##DO NOT CHANGE THIS LINE!!! 49 48 # Set the name same as the file name 49 self.name = self.get_fname() ##DO NOT CHANGE THIS LINE!!! 50 50 ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 51 51 ## YOU CAN ALSO DELETE THIS LINE … … 112 112 113 113 return result ## MODIFY ONLY RESULT. DON'T DELETE RETURN!!!! 114 114 115 ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! 116 def get_fname(self): 117 """ 118 Get the model name same as the file name 119 """ 120 path = sys._getframe().f_code.co_filename 121 basename = os.path.basename(path) 122 name, _ = os.path.splitext(basename) 123 return name 124 115 125 ############################################################################### 116 126 ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! -
fittingview/src/sans/perspectives/fitting/plugin_models/sum_Ap1_1_Ap2.py
r19e614a r316e231 2 2 import copy 3 3 from sans.models.pluginmodel import Model1DPlugin 4 4 import os 5 import sys 5 6 """ 6 7 ## ***************************************************************************** … … 43 44 Note: P(Q) refers to 'form factor' model. 44 45 """ 45 name = " sum_Ap1_1_Ap2" ## <----- FILE NAME (NAME OF THE MODEL)46 name = "" 46 47 def __init__(self): 47 48 Model1DPlugin.__init__(self, name=self.name) … … 55 56 self.description = "" 56 57 self.fill_description(p_model1, p_model2) 57 58 # Set the name same as the file name 59 self.name = self.get_fname() ##DO NOT CHANGE THIS LINE!!! 58 60 ## Define parameters 59 61 self.params = {} … … 391 393 ( p_model1.name, p_model2.name ) 392 394 self.description += description 393 395 396 ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! 397 def get_fname(self): 398 """ 399 Get the model name same as the file name 400 """ 401 path = sys._getframe().f_code.co_filename 402 basename = os.path.basename(path) 403 name, _ = os.path.splitext(basename) 404 return name 405 394 406 ### FOR TEST 395 407 if __name__ == "__main__": -
fittingview/src/sans/perspectives/fitting/plugin_models/sum_p1_p2.py
r19e614a r316e231 2 2 import copy 3 3 from sans.models.pluginmodel import Model1DPlugin 4 4 import os 5 import sys 5 6 """ 6 7 ## ***************************************************************************** … … 48 49 Note: P(Q) refers to 'form factor' model. 49 50 """ 50 name = " sum_p1_p2" ## <----- FILE NAME (NAME OF THE MODEL)51 name = "" 51 52 def __init__(self): 52 53 Model1DPlugin.__init__(self, name=self.name) … … 63 64 self.description += p_model2.name+"\n" 64 65 self.fill_description(p_model1, p_model2) 65 66 # Set the name same as the file name 67 self.name = self.get_fname() ##DO NOT CHANGE THIS LINE!!! 66 68 ## Define parameters 67 69 self.params = {} … … 399 401 ( p_model1.name, p_model2.name ) 400 402 self.description += description 401 403 404 ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! 405 def get_fname(self): 406 """ 407 Get the model name same as the file name 408 """ 409 path = sys._getframe().f_code.co_filename 410 basename = os.path.basename(path) 411 name, _ = os.path.splitext(basename) 412 return name 413 402 414 if __name__ == "__main__": 403 415 m1= Model() -
fittingview/src/sans/perspectives/fitting/plugin_models/testmodel.py
r19e614a r316e231 18 18 import math ##DO NOT CHANGE THIS LINE!!! 19 19 import numpy ##DO NOT CHANGE THIS LINE!!! 20 20 import os 21 import sys 21 22 ##PLEASE READ COMMENTS CAREFULLY !!! COMMENT ARE IN CAPITAL LETTERS AND AFTER ## 22 23 ## THESE COMMENTS ARE THERE TO GUIDE YOU. YOU CAN REMOVE THEM ONLY WHEN YOU ARE … … 33 34 ##EXAMPLE:Class that evaluates a cos(x) model. 34 35 """ 35 36 ## YOU CAN MODIFY THE LINE BELLOW. CHANGE ONLY WORDS BETWEEN " " 37 ## TO RENAME YOUR MODEL 38 name = "testmodel" ## <----- FILE NAME (NAME OF THE MODEL) 36 name = "" 39 37 40 38 def __init__(self): … … 47 45 ## DELETE MODIFIABLE LINE HERE WILL REDUCE THE NUMBER OF PARAMETERS 48 46 self.params = {} ##DO NOT CHANGE THIS LINE!!! 47 # Set the name same as the file name 48 self.name = self.get_fname() ##DO NOT CHANGE THIS LINE!!! 49 49 ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 50 50 ## YOU CAN ALSO DELETE THIS LINE … … 86 86 return self.params['A']+self.params['B']*math.cos(2.0*x)+self.params['C']*math.sin(2.0*x) 87 87 88 ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! 89 def get_fname(self): 90 """ 91 Get the model name same as the file name 92 """ 93 path = sys._getframe().f_code.co_filename 94 basename = os.path.basename(path) 95 name, _ = os.path.splitext(basename) 96 return name 97 88 98 ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! 89 99 if __name__ == "__main__": -
fittingview/src/sans/perspectives/fitting/plugin_models/testmodel_2.py
r19e614a r316e231 18 18 import math ##DO NOT CHANGE THIS LINE!!! 19 19 import numpy ##DO NOT CHANGE THIS LINE!!! 20 20 import os 21 import sys 21 22 ##PLEASE READ COMMENTS CAREFULLY !!! COMMENT ARE IN CAPITAL LETTERS AND AFTER ## 22 23 ## THESE COMMENTS ARE THERE TO GUIDE YOU. YOU CAN REMOVE THEM ONLY WHEN YOU ARE … … 33 34 ##EXAMPLE: Class that evaluates a polynomial model. 34 35 """ 35 ## YOU CAN MODIFY THE LINE BELLOW. CHANGE ONLY WORDS BETWEEN " " 36 ## TO RENAME YOUR MODEL 37 name = "testmodel_2" ## <----- FILE NAME (NAME OF THE MODEL) 36 name = "" 38 37 39 38 def __init__(self): ##DO NOT CHANGE THIS LINE!!! … … 46 45 ## DELETE MODIFIABLE LINE HERE WILL REDUCE THE NUMBER OF PARAMETERS 47 46 self.params = {} ##DO NOT CHANGE THIS LINE!!! 48 47 # Set the name same as the file name 48 self.name = self.get_fname() ##DO NOT CHANGE THIS LINE!!! 49 49 ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 50 50 ## YOU CAN ALSO DELETE THIS LINE … … 148 148 149 149 return result ## MODIFY ONLY RESULT. DON'T DELETE RETURN!!!! 150 150 151 ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! 152 def get_fname(self): 153 """ 154 Get the model name same as the file name 155 """ 156 path = sys._getframe().f_code.co_filename 157 basename = os.path.basename(path) 158 name, _ = os.path.splitext(basename) 159 return name 160 151 161 ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! 152 162 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.