Changeset 2f4b430 in sasview for src/sas/perspectives/fitting/fitproblem.py
- Timestamp:
- Mar 4, 2015 3:39:45 PM (10 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:
- 74f419d
- Parents:
- 2f732b0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/fitting/fitproblem.py
r7a04dbb r2f4b430 27 27 flag is 0 ingore smear value. 28 28 """ 29 29 30 30 def get_smearer(self): 31 31 """ … … 35 35 """ 36 36 """ 37 37 38 38 def get_name(self): 39 39 """ 40 40 """ 41 41 42 42 def set_model(self, model): 43 43 """ … … 46 46 :param name: name created for model 47 47 """ 48 48 49 49 def get_model(self): 50 50 """ 51 51 :return: saved model 52 52 """ 53 53 54 54 def set_residuals(self, residuals): 55 55 """ … … 57 57 :param data: data selected 58 58 """ 59 59 60 60 def get_residuals(self): 61 61 """ 62 62 :return: residuals 63 63 """ 64 64 65 65 def set_theory_data(self, data): 66 66 """ … … 68 68 :param data: data selected 69 69 """ 70 70 71 71 def get_theory_data(self): 72 72 """ 73 73 :return: list of data dList 74 74 """ 75 75 76 76 def set_fit_data(self, data): 77 77 """ … … 81 81 :param data: list of data selected 82 82 """ 83 83 84 84 def get_fit_data(self): 85 85 """ 86 86 """ 87 87 88 88 def set_model_param(self, name, value=None): 89 89 """ … … 92 92 :param value: value of that parameter 93 93 """ 94 94 95 95 def set_param2fit(self, list): 96 96 """ … … 98 98 :param list: list of the param names 99 99 """ 100 100 101 101 def get_param2fit(self): 102 102 """ 103 103 return the list param names to fit 104 104 """ 105 105 106 106 def get_model_param(self): 107 107 """ 108 108 return list of couple of parameter name and value 109 109 """ 110 110 111 111 def schedule_tofit(self, schedule=0): 112 112 """ 113 113 set schedule to true to decide if this fit must be performed 114 114 """ 115 115 116 116 def get_scheduled(self): 117 117 """ 118 118 return true or false if a problem as being schedule for fitting 119 119 """ 120 120 121 121 def set_range(self, qmin=None, qmax=None): 122 122 """ 123 123 set fitting range 124 124 """ 125 125 126 126 def get_range(self): 127 127 """ 128 128 :return: fitting range 129 129 """ 130 130 131 131 def set_weight(self, flag=None): 132 132 """ 133 133 set fitting range 134 134 """ 135 135 136 136 def get_weight(self): 137 137 """ 138 138 get fitting weight 139 139 """ 140 140 141 141 def clear_model_param(self): 142 142 """ 143 143 clear constraint info 144 144 """ 145 145 146 146 def set_fit_tab_caption(self, caption): 147 147 """ 148 148 store the caption of the page associated with object 149 149 """ 150 150 151 151 def get_fit_tab_caption(self): 152 152 """ 153 153 Return the caption of the page associated with object 154 154 """ 155 155 156 156 def set_graph_id(self, id): 157 157 """ 158 Set graph id (from data_group_id at the time the graph produced) 159 """ 160 158 Set graph id (from data_group_id at the time the graph produced) 159 """ 160 161 161 def get_graph_id(self): 162 162 """ … … 173 173 """ 174 174 175 175 176 176 class FitProblemDictionary(FitProblemComponent, dict): 177 177 """ … … 198 198 self.batch_inputs = {} 199 199 self.batch_outputs = {} 200 200 201 201 def enable_smearing(self, flag=False, fid=None): 202 202 """ … … 211 211 if fid in self.iterkeys(): 212 212 self[fid].enable_smearing(flag) 213 213 214 214 def set_smearer(self, smearer, fid=None): 215 215 """ … … 223 223 if fid in self.iterkeys(): 224 224 self[fid].set_smearer(smearer) 225 225 226 226 def get_smearer(self, fid=None): 227 227 """ … … 230 230 if fid in self.iterkeys(): 231 231 return self[fid].get_smearer() 232 232 233 233 def save_model_name(self, name, fid=None): 234 234 """ … … 240 240 if fid in self.iterkeys(): 241 241 self[fid].save_model_name(name) 242 242 243 243 def get_name(self, fid=None): 244 244 """ … … 252 252 result.append(self[fid].get_name()) 253 253 return result 254 254 255 255 def set_model(self, model, fid=None): 256 256 """ … … 266 266 if fid in self.iterkeys(): 267 267 self[fid].set_model(self.model) 268 268 269 269 def get_model(self, fid): 270 270 """ … … 273 273 if fid in self.iterkeys(): 274 274 return self[fid].get_model() 275 275 276 276 def set_fit_tab_caption(self, caption): 277 277 """ … … 279 279 """ 280 280 self.fit_tab_caption = caption 281 281 282 282 def get_fit_tab_caption(self): 283 283 """ … … 285 285 """ 286 286 return self.fit_tab_caption 287 287 288 288 def set_residuals(self, residuals, fid): 289 289 """ … … 293 293 if fid in self.iterkeys(): 294 294 self[fid].set_residuals(residuals) 295 295 296 296 def get_residuals(self, fid): 297 297 """ … … 300 300 if fid in self.iterkeys(): 301 301 return self[fid].get_residuals() 302 302 303 303 def set_theory_data(self, fid, data=None): 304 304 """ … … 308 308 if fid in self.iterkeys(): 309 309 self[fid].set_theory_data(data) 310 310 311 311 def get_theory_data(self, fid): 312 312 """ … … 315 315 if fid in self.iterkeys(): 316 316 return self[fid].get_theory_data() 317 317 318 318 def add_data(self, data): 319 319 """ … … 325 325 self[data.id] = FitProblem() 326 326 self[data.id].set_fit_data(data) 327 327 328 328 def set_fit_data(self, data): 329 329 """ 330 330 save a copy of the data select to fit 331 331 :param data: data selected 332 332 333 333 """ 334 334 self.clear() … … 342 342 self[d.id].set_model(self.model) 343 343 self[d.id].set_range(self.qmin, self.qmax) 344 344 345 345 def get_fit_data(self, fid): 346 346 """ … … 351 351 if fid in self.iterkeys(): 352 352 return self[fid].get_fit_data() 353 353 354 354 def set_model_param(self, name, value=None, fid=None): 355 355 """ … … 364 364 if fid in self.iterkeys(): 365 365 self[fid].set_model_param(name, value) 366 366 367 367 def get_model_param(self, fid): 368 368 """ … … 371 371 if fid in self.iterkeys(): 372 372 return self[fid].get_model_param() 373 373 374 374 def set_param2fit(self, list): 375 375 """ … … 378 378 """ 379 379 self.list_param2fit = list 380 380 381 381 def get_param2fit(self): 382 382 """ … … 384 384 """ 385 385 return self.list_param2fit 386 386 387 387 def schedule_tofit(self, schedule=0): 388 388 """ … … 392 392 for value in self.itervalues(): 393 393 value.schedule_tofit(schedule) 394 394 395 395 def get_scheduled(self): 396 396 """ … … 398 398 """ 399 399 return self.scheduled 400 400 401 401 def set_range(self, qmin=None, qmax=None, fid=None): 402 402 """ … … 411 411 if fid in self.iterkeys(): 412 412 self[fid].value.set_range(self.qmin, self.qmax) 413 413 414 414 def get_range(self, fid): 415 415 """ … … 418 418 if fid in self.iterkeys(): 419 419 return self[fid].get_range() 420 420 421 421 def set_weight(self, is2d, flag=None, fid=None): 422 422 """ … … 429 429 if fid in self.iterkeys(): 430 430 self[fid].set_weight(flag=flag, is2d=is2d) 431 431 432 432 def get_weight(self, fid=None): 433 433 """ … … 436 436 if fid in self.iterkeys(): 437 437 return self[fid].get_weight() 438 438 439 439 def clear_model_param(self, fid=None): 440 440 """ … … 447 447 if fid in self.iterkeys(): 448 448 self[fid].clear_model_param() 449 449 450 450 def get_fit_problem(self): 451 451 """ … … 453 453 """ 454 454 return self.itervalues() 455 455 456 456 def set_result(self, result, fid): 457 457 """ … … 459 459 if fid in self.iterkeys(): 460 460 self[fid].set_result(result) 461 461 462 462 def set_batch_result(self, batch_inputs, batch_outputs): 463 463 """ … … 466 466 self.batch_inputs = batch_inputs 467 467 self.batch_outputs = batch_outputs 468 468 469 469 def get_result(self, fid): 470 470 """ … … 473 473 if fid in self.iterkeys(): 474 474 return self[fid].get_result() 475 475 476 476 def get_batch_result(self): 477 477 """ … … 479 479 """ 480 480 return self.batch_inputs, self.batch_outputs 481 481 482 482 def set_graph_id(self, id): 483 483 """ 484 Set graph id (from data_group_id at the time the graph produced) 484 Set graph id (from data_group_id at the time the graph produced) 485 485 """ 486 486 self.graph_id = id 487 487 488 488 def get_graph_id(self): 489 489 """ … … 491 491 """ 492 492 return self.graph_id 493 494 493 494 495 495 class FitProblem(FitProblemComponent): 496 496 """ … … 527 527 self.weight = None 528 528 self.result = None 529 529 530 530 def enable_smearing(self, flag=False): 531 531 """ … … 534 534 """ 535 535 self.smearer_enable = flag 536 536 537 537 def set_smearer(self, smearer): 538 538 """ 539 539 save reference of smear object on fitdata 540 540 541 541 :param smear: smear object from DataLoader 542 542 543 543 """ 544 544 self.smearer_computer_value = smearer 545 545 546 546 def get_smearer(self): 547 547 """ … … 556 556 self.smearer_computed = True 557 557 return self.smearer_computer_value 558 558 559 559 def save_model_name(self, name): 560 560 """ 561 561 """ 562 562 self.name_per_page = name 563 563 564 564 def get_name(self): 565 565 """ 566 566 """ 567 567 return self.name_per_page 568 568 569 569 def set_model(self, model): 570 570 """ … … 577 577 self.model) 578 578 self.smearer_computed = True 579 579 580 580 def get_model(self): 581 581 """ … … 583 583 """ 584 584 return self.model 585 585 586 586 def set_residuals(self, residuals): 587 587 """ … … 590 590 """ 591 591 self.residuals = residuals 592 592 593 593 def get_residuals(self): 594 594 """ … … 596 596 """ 597 597 return self.residuals 598 598 599 599 def set_theory_data(self, data): 600 600 """ 601 601 save a copy of the data select to fit 602 602 603 603 :param data: data selected 604 604 605 605 """ 606 606 self.theory_data = copy.deepcopy(data) 607 607 608 608 def get_theory_data(self): 609 609 """ … … 627 627 self.smearer_computed = True 628 628 self.result = None 629 629 630 630 def get_fit_data(self): 631 631 """ … … 633 633 """ 634 634 return self.fit_data 635 635 636 636 def get_origin_data(self): 637 637 """ 638 638 """ 639 639 return self.original_data 640 640 641 641 def set_weight(self, is2d, flag=None): 642 642 """ … … 658 658 """ 659 659 return self.weight 660 660 661 661 def set_param2fit(self, list): 662 662 """ … … 665 665 """ 666 666 self.list_param2fit = list 667 667 668 668 def get_param2fit(self): 669 669 """ … … 671 671 """ 672 672 return self.list_param2fit 673 673 674 674 def set_model_param(self, name, value=None): 675 675 """ … … 679 679 """ 680 680 self.list_param.append([name, value]) 681 681 682 682 def get_model_param(self): 683 683 """ … … 685 685 """ 686 686 return self.list_param 687 687 688 688 def schedule_tofit(self, schedule=0): 689 689 """ … … 691 691 """ 692 692 self.schedule = schedule 693 693 694 694 def get_scheduled(self): 695 695 """ … … 697 697 """ 698 698 return self.schedule 699 699 700 700 def set_range(self, qmin=None, qmax=None): 701 701 """ … … 706 706 self.qmin = qmin 707 707 self.qmax = qmax 708 708 709 709 def get_range(self): 710 710 """ 711 711 :return: fitting range 712 712 713 713 """ 714 714 return self.qmin, self.qmax 715 715 716 716 def clear_model_param(self): 717 717 """ … … 719 719 """ 720 720 self.list_param = [] 721 721 722 722 def set_fit_tab_caption(self, caption): 723 723 """ 724 724 """ 725 725 self.fit_tab_caption = str(caption) 726 726 727 727 def get_fit_tab_caption(self): 728 728 """ 729 729 """ 730 730 return self.fit_tab_caption 731 731 732 732 def set_graph_id(self, id): 733 733 """ … … 735 735 """ 736 736 self.graph_id = id 737 737 738 738 def get_graph_id(self): 739 739 """ … … 741 741 """ 742 742 return self.graph_id 743 743 744 744 def set_result(self, result): 745 745 """ 746 746 """ 747 747 self.result = result 748 748 749 749 def get_result(self): 750 750 """
Note: See TracChangeset
for help on using the changeset viewer.