Changeset feb21d8 in sasview for prview/perspectives/pr
- Timestamp:
- Jul 8, 2008 1:37:00 PM (16 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:
- 5615a7b
- Parents:
- 6e0f53a
- Location:
- prview/perspectives/pr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
prview/perspectives/pr/pr.py
r357b79b rfeb21d8 60 60 self.invertor = None 61 61 self.pr = None 62 self.pr_estimate = None 62 # Copy of the last result in case we need to display it. 63 self._last_pr = None 64 self._last_out = None 65 self._last_cov = None 63 66 ## Calculation thread 64 67 self.calc_thread = None … … 73 76 ## Flag to let the plug-in know that it is running standalone 74 77 self.standalone = True 78 self._normalize_output = False 79 self._scale_output_unity = False 75 80 76 81 # Log startup … … 265 270 self._pr_npts= dialog.get_content() 266 271 dialog.Destroy() 267 self.show_pr(self. pr.out, self.pr, self.pr.cov)272 self.show_pr(self._last_out, self._last_pr, self._last_cov) 268 273 else: 269 274 dialog.Destroy() … … 285 290 286 291 sum = 0.0 292 pmax = 0.0 287 293 cov2 = numpy.ascontiguousarray(cov) 288 294 … … 293 299 (value, dy[i]) = pr.pr_err(out, cov2, x[i]) 294 300 sum += value*pr.d_max/len(x) 301 302 # keep track of the maximum P(r) value 303 if value>pmax: 304 pmax = value 305 295 306 y[i] = value 296 297 y = y/sum 298 dy = dy/sum 307 308 if self._normalize_output==True: 309 y = y/sum 310 dy = dy/sum 311 elif self._scale_output_unity==True: 312 y = y/pmax 313 dy = dy/pmax 299 314 300 315 if cov2==None: … … 378 393 for item in graph.plottables: 379 394 if item.name==PR_FIT_LABEL: 380 return[["Add P(r) data", "Load a data file and display it on this plot", self._on_add_data],395 m_list = [["Add P(r) data", "Load a data file and display it on this plot", self._on_add_data], 381 396 ["Change number of P(r) points", "Change the number of points on the P(r) output", self._on_pr_npts]] 397 398 m_list.append(["Disable P(r) scaling", 399 "Let the output P(r) keep the scale of the data", 400 self._on_disable_scaling]) 401 402 if self._scale_output_unity==False: 403 m_list.append(["Scale P_max(r) to unity", 404 "Scale P(r) so that its maximum is 1", 405 self._on_scale_unity]) 406 407 if self._normalize_output==False: 408 m_list.append(["Normalize P(r) to unity", 409 "Normalize the integral of P(r) to 1", 410 self._on_normalize]) 411 412 return m_list 413 #return [["Add P(r) data", "Load a data file and display it on this plot", self._on_add_data], 414 # ["Change number of P(r) points", "Change the number of points on the P(r) output", self._on_pr_npts]] 382 415 383 416 elif item.name==graph.selected_plottable: … … 386 419 return [] 387 420 421 def _on_disable_scaling(self, evt): 422 """ 423 Disable P(r) scaling 424 @param evt: Menu event 425 """ 426 self._normalize_output = False 427 self._scale_output_unity = False 428 self.show_pr(self._last_out, self._last_pr, self._last_cov) 429 430 def _on_normalize(self, evt): 431 """ 432 Switch normalization ON/OFF 433 @param evt: Menu event 434 """ 435 self._normalize_output = True 436 self._scale_output_unity = False 437 438 self.show_pr(self._last_out, self._last_pr, self._last_cov) 439 440 def _on_scale_unity(self, evt): 441 """ 442 Switch normalization ON/OFF 443 @param evt: Menu event 444 """ 445 self._scale_output_unity = True 446 self._normalize_output = False 447 448 self.show_pr(self._last_out, self._last_pr, self._last_cov) 449 388 450 def _on_add_data(self, evt): 389 451 """ … … 468 530 # Save useful info 469 531 self.elapsed = elapsed 532 # Keep a copy of the last result 533 self._last_pr = pr.clone() 534 self._last_out = out 535 self._last_cov = cov 536 470 537 # Save Pr invertor 471 538 self.pr = pr -
prview/perspectives/pr/requirements.txt
r660b1e6 rfeb21d8 2 2 2. Find good defaults. Automate the inversion. 3 3 -How do we estimate d_max? Guinier fit? 4 -How do we estimate alpha? [ partiallydone]4 -How do we estimate alpha? [done] 5 5 Compute the residuals once and choose a value that brings the reg term up to 6 6 a fraction of the residuals. 7 7 3. When fitting a plottable on a Graph with multiple plottables, remember the one the user chose [done] 8 4. What q-range do we need to make it work? What are the constraints? 9 5. Create handshake so that a plug-in can set context menu items to its own panels... 10 6. Return figure of merit values and suggest the values for d_max and alpha. 8 4. What q-range do we need to make it work? What are the constraints? [studied by Raiza] 9 5. Create handshake so that a plug-in can set context menu items to its own panels... [done] 10 6. Return figure of merit values and suggest the values for d_max and alpha. [alpha, nfunc done] 11 11 7. Show time estimate [done] 12 8. Plot the reg term alone to see what it looks like 13 9. Use data loader perspective/plug-in to load data/choose file 14 10. Common module for file reading and file choosing 15 11. Define limits of applicability 16 12. Return figures of merit 12 8. Plot the reg term alone to see what it looks like 13 9. Use data loader perspective/plug-in to load data/choose file [done] 14 10. Common module for file reading and file choosing 15 11. Define limits of applicability 16 12. Return figures of merit [done] 17 17 13. Errors on output constants [done] 18 14. Clean up the InversionDialog 19 15. Add online help for inputs and outputs (especially figures of merit) 18 14. Clean up the InversionDialog [done] 19 15. Add online help for inputs and outputs (especially figures of merit) [done] 20 20 16. Add help text to the interface (description of what we are minimizing, to explain alpha and nfunc). 21 17. Get rid of all output prints. 21 17. Get rid of all output prints. 22 22 18. Clean up 23 23 19. Replace help dialog text with a nice image. Mention how to choose alpha and what the suggested alpha means. 24 24 20. If a figure of merit is clearly bad, put its background red 25 21. Option to save data. 26 22. If you click compute before loading data, an error occurs. 27 23. Plot I(q) immediately when you choose a new file. 25 21. Option to save data. [done] 26 22. If you click compute before loading data, an error occurs. [fixed] 27 23. Plot I(q) immediately when you choose a new file. [done] 28 28 24. *** probably need to ship the perspectives separately... 29 25. If no data is available, disable the Fit button. 29 25. If no data is available, disable the Fit button. [Message sent instead] 30 26. Remove an added curve... 31 27. Add multiple additional data curves.
Note: See TracChangeset
for help on using the changeset viewer.