Changeset 35ac8df in sasview


Ignore:
Timestamp:
Aug 21, 2018 9:20:27 AM (7 months ago)
Author:
krzywon
Branches:
master, release-4.2.2, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, unittest-saveload
Children:
c2525bf
Parents:
96d06a4 (diff), ec52ea1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into ticket-1111

Files:
4 added
5 deleted
27 edited
7 moved

Legend:

Unmodified
Added
Removed
  • docs/sphinx-docs/source/conf.py

    rf1d48e9 ra8bbba2  
    7171# General information about the project. 
    7272project = u'SasView' 
    73 copyright = u'2017, The SasView Project' 
     73copyright = u'2018, The SasView Project' 
    7474 
    7575# The version info for the project you're documenting, acts as replacement for 
     
    8080version = '4.2' 
    8181# The full version, including alpha/beta/rc tags. 
    82 release = '4.2.0' 
     82release = '4.2.0-beta' 
    8383 
    8484# The language for content autogenerated by Sphinx. Refer to documentation 
  • docs/sphinx-docs/source/user/working.rst

    r3bd677b rc1790a5  
    1919   Writing a Plugin Model <sasgui/perspectives/fitting/plugin> 
    2020 
     21   Environment Variables <environment> 
     22 
    2123   Model marketplace <marketplace> 
  • installers/README-next-release.txt

    r2f6d340 rfde3042  
    1    - New in Version 3.?.? 
     1Release Notes 
     2============= 
     3     
     41- Features 
     5=========== 
     6    - New in Version 4.2.0 
     7      -------------------- 
     8      This point release heralds many improvements and a host of bug fixes. But there are also some significant changes from previous versions. 
     9       
     10      - Changes 
     11         - The infrastucture for calculating 2D patterns from 3D orientated objects has been totally re-factored. It is now more accurate and consistent across models. 
     12         - The way that SasView defines the orientation of anisometric and aligned objects has been completely overhauled. It now differs from previous versions. 
     13         - Plugin models, including sum/multiply models, have completely migrated to the new infrastructure. ???DO WE NEED TO SAY SOMETHING ABOUT BACKWARD COMPATIBILITY OR LEGACY SUPPORT HERE??? 
     14         - The NeXus loader has been removed (as it is superseded by the NXcanSAS loader). 
     15      - Improvements 
     16         - The accuracy/speed of some numerical integrations have been improved. ???CHECK WITH PAULK??? 
     17         - An orientation viewer tool has been introduced (to assist in understanding the new orientation framework). 
     18         - Problems with the computation of magnetic scattering from some objects have been rectified. 
     19         - The known issue with the core_shell_parallelepiped model is now fixed. 
     20         - A number of issues and inconsistencies with the creation of sum|product models have been rectified (and more work is in progress). 
     21         - A Boltzmann distribution has been added for polydispersity/orientational distributions. 
     22         - Some batch slicing options have been introduced. 
     23         - Correlation function analysis now computes both the 1D and 3D functions. 
     24         - There are several data loading improvements. 
     25         - There are several improvements to Save/Load Project (with more to come). 
     26         - There have been numerous other bug fixes. 
     27      - Documentation 
     28         Several sections of the help documentation have undergone significant checking and updating, particularly those relating to orientation, magnetic scattering, and polydispersity distributions. 
     29      - Other work 
     30         - A Third-Party initiative has recently succeeded in getting SasView to run on Debian. More details at http://trac.sasview.org/wiki/DevNotes/Projects/Debian 
     31         - With this release we have started to prepare for the inevitable move to Python 3. 
     32         - SasView 5.0 is already in development. The two most significant features of this version will be (i) a move away from the present WxPython GUIs to new Qt5 GUIs, and (ii) implementation of the Beta-approximation for S(Q). Subject to resources, the latter functionality may be released (in a non-GUI form) in an interim SasView 4.3.0. 
     33      - Bug Fixes 
     34         Fixes #  14: Loading a saved project is really really slow   
     35         Fixes # 260: Box integration does not update when entering values in dialog   
     36         Fixes # 379: Need to make the BUMPS output page more more obvious   
     37         Fixes # 446: Saving plot as PGF (not PDF!) format throws error   
     38         Fixes # 467: Extend batch functionality to slicer   
     39         Fixes # 489: ABS reader (NIST 1D) does not handle negative dx properly (USANS slit smearing)   
     40         Fixes # 499: create sin(x)/x, 2*J1(x)/x and 3*j1(x)/x functions   
     41         Fixes # 510: Build PDF documentation along with HTML   
     42         Fixes # 525: Add GUI category defaults to models in sasmodels   
     43         Fixes # 579: clean up sasview directory   
     44         Fixes # 597: Need to document Combine Batch Fit   
     45         Fixes # 645: GUI logic problem in Batch vs single fit mode   
     46         Fixes # 648: Need to allow user input background value in Pr perspective   
     47         Fixes # 685: Fix data upload to marketplace   
     48         Fixes # 695: linear slope in onion model   
     49         Fixes # 735: Review new Corfunc documentation   
     50         Fixes # 741: Recalculate P(Q) and S(Q) components on model update.   
     51         Fixes # 767: Sum/Product Models don't do what they should   
     52         Fixes # 776: angular dispersity   
     53         Fixes # 784: Add 3D integral to Correlation Function analysis   
     54         Fixes # 786: core_shell_parallelepiped 1-D model is incorrect   
     55         Fixes # 818: “report button” followed by “save” makes an empty pdf file???   
     56         Fixes # 830: Check compliance of loader against NXcanSAS-1.0 release   
     57         Fixes # 838: Fix model download from marketplace   
     58         Fixes # 848: can't save analysis when only one fit page   
     59         Fixes # 849: Load Folder should ignore files starting with .   
     60         Fixes # 852: More unit tests, especially for oriented or 2d models   
     61         Fixes # 854: remove unnecessary sleep() in fitting perspective   
     62         Fixes # 856: Reading SAS_OPENCL from custom_config sometimes raises an ERROR   
     63         Fixes # 861: cannot defined a structure factor plugin   
     64         Fixes # 864: New Model Editor (simple plugin editor) error parsing parameter line   
     65         Fixes # 865: Plugin live discovery issues   
     66         Fixes # 866: inform user when NaN is returned from compute   
     67         Fixes # 869: fit page computation thread cleanup   
     68         Fixes # 875: Possible weirdness with 1D NXcanSAS data   
     69         Fixes # 876: Add check for HDF5 format in dataloader   
     70         Fixes # 887: reorganize tree, separating the installed source from the build source   
     71         Fixes # 889: Refactor dataloader error handling infrastructure   
     72         Fixes # 890: use new orientation definition for asymmetric shapes   
     73         Fixes # 891: update docs for oriented shapes with new orientation definition   
     74         Fixes # 896: equations in core shell parallelepiped docs do not match code   
     75         Fixes # 898: Image Viewer Tool file selector issue   
     76         Fixes # 899: Igor Reader q calculation   
     77         Fixes # 902: IgorReader Q calculation needs fixing/improving   
     78         Fixes # 903: sasview - all non-gui tests should be converted to run in Python 3   
     79         Fixes # 906: polydispersity not showing up in tabulated results   
     80         Fixes # 912: About box points to misleading contributors page on Github   
     81         Fixes # 913: Need to add Diamond developer and logo in relevant places   
     82         Fixes # 915: load project issues   
     83         Fixes # 916: Proper Logging   
     84         Fixes # 920: Logarithmic binning option in the slice viewer   
     85         Fixes # 921: Improve developer communication methods   
     86         Fixes # 922: Remove support for all data formats that are not in q space   
     87         Fixes # 923: Add CI and trac integrations to Slack   
     88         Fixes # 930: fitting help says chisq is normalized to number of points   
     89         Fixes # 931: Allow admins to edit all models and upload data etc on marketplace   
     90         Fixes # 932: Need to fix upload of data files to marketplace   
     91         Fixes # 934: Slurp tutorial repo for tutorials   
     92         Fixes # 935: Build new tutorials as PDF   
     93         Fixes # 943: Deep copy error on setting model after data is selected   
     94         Fixes # 950: Most of the readers don't close files properly.   
     95         Fixes # 954: cross check dll/opencl/python polydispersity and orientation results   
     96         Fixes # 956: Possible problem with new doc build process   
     97         Fixes # 961: sasmodels tests should fail if the parameter name does not exist   
     98         Fixes # 962: star polymer typo in docs   
     99         Fixes # 966: Inconsistent chi2 reporting   
     100         Fixes # 967: no uncertainties errors on fitting parameters   
     101         Fixes # 969: About Box not picking up dls_logo.png   
     102         Fixes # 970: ASCII loader doesn't handle ISIS 2D ASCII   
     103         Fixes # 974: blacklist Intel HD 620/630 for double precision   
     104         Fixes # 978: load project fails for pages which have not been defined   
     105         Fixes # 980: Inconsistent results between Igor & SasView using Fractal Core-Shell model   
     106         Fixes # 983: Remove Nexus Loader   
     107         Fixes # 984: PDF reports are not being properly generated on Windows   
     108         Fixes # 985: Saving Project Fails   
     109         Fixes # 986: Send to fitting overwrites theory page even if blank FitPage has focus   
     110         Fixes # 990: utest_sasview.py giving different results than run_one.py   
     111         Fixes # 993: Windows x64 versions not installing to correct folder   
     112         Fixes # 994: Error changing fit engine   
     113         Fixes # 995: OpenCL required on Linux even if turned off in GUI   
     114         Fixes #1006: multiplicity models don't work with SQ   
     115         Fixes #1007: spherical_sld model freezes SasView   
     116         Fixes #1008: plugin model scaling not working? S  
     117         Fixes #1010: Win64 build script not creating working executable   
     118         Fixes #1011: sld_test failing on ubuntu   
     119         Fixes #1012: ESS GUI not updating after fitting   
     120         Fixes #1013: FileReaderBaseClass output[] not reset - same file loaded multiple times   
     121         Fixes #1018: add Boltzmann distribution   
     122         Fixes #1021: add PDF documentation to website and document in wiki release process   
     123         Fixes #1024: Update version numbers in master   
     124         Fixes #1025: Sum/multiply editor hangs   
     125         Fixes #1032: convert C++ modules to C   
     126         Fixes #1035: Order of combining P(Q) and S(Q) in Plugins seems to matter   
     127         Fixes #1037: data loader crop not working? & all fits crashing   
     128         Fixes #1043: problem compiling marketplace models   
     129         Fixes #1050: fix appveyor test for sasmodels win 64 python 3   
     130         Fixes #1052: Can't use a user-created plugin model in a plugin model   
     131         Fixes #1054: Check plugin & orientation descriptions in full docs once SasModels PR #57 is merged   
     132         Fixes #1057: phi rotation issue for elliptical cylinder   
     133         Fixes #1060: incorrect default for rectangle dispersion   
     134         Fixes #1062: win32 build not installing correctly   
     135         Fixes #1064: Fitting did not converge!!! error with a Sum|Multi plugin model   
     136         Fixes #1068: 2d data (from NG7) not loadiing - strange format?   
     137         Fixes #1069: GUI problem when using polydispersity/orientation distributions   
     138         Fixes #1070: Parameter error boxes should not be editable   
     139         Fixes #1072: Orientation distributions seem to depend on initial angle   
     140         Fixes #1079: Remove save button in report dialog on Mac   
     141         Fixes #1081: GUI problem with new orientation distribution   
     142         Fixes #1083: Magnetic models not being computed   
     143         Fixes #1099: Erratic behaviour of Sum|Multi model in 4.1.2   
     144         Fixes #1101: Batch results page not displaying polydispersity values   
     145         Fixes #1103: Problem with plugin models on mac when using ER   
     146         Fixes #1134: sum/multi scale factor in 4.2 seems incorrect?   
     147         Fixes #1139: Missing Docs and Help for new Batch Slicing   
     148         Fixes #1145: Update models in model marketplace to 4.2 when 4.2 is released.   
     149         Fixes #1146: Need to add Release notes for 4.2  
     150      - Current Known Issues 
     151         Listed here are known issues that users should be aware of. A full list of known bugs and feature requests is available at http://trac.sasview.org/report/3 
     152      - Blocker 
     153         Ticket #1131: OpencCl dialog does not open                                              assigned wojciech defect blocker 
     154         Ticket #1132: Slit Size Calculator Tool not working                                     assigned krzywon defect blocker 
     155         Ticket #1133: Reference in Acknowledging SasView box will need updating for release     assigned ajj task blocker 
     156         Ticket #1142: Plugin framework is broken                                                reopened pkienzle defect blocker 
     157      - Critical 
     158         Ticket #1148: Documentation for S(Q) models need updating SasView 4.2.0                 assigned butler defect critical 
     159      - Other Significant 
     160         Ticket #1046: convert non builtin models in the marketplace to new API                  assigned butler task major 
     161         Ticket #1128: AutoPlot generation for model documentation does not include background   assigned pkienzle defect major 
     162         Ticket #1140: Batch Slicer requires plotting of all 2D data sets to use in batch        assigned krzywon enhancement major 
     163         Ticket #1141: Intro to scripting.rst needs improvement                                  new pkienzle enhancement major 
     164         Ticket #1143: Validate new orientation distribution                                     assigned butler task major 
     165         Ticket #1144: Redundant MultiplicationModel class                                       new pkienzle defect major 
     166      - Model Issues 
     167         Corrections will be posted to Marketplace as available (and fixed in following release) 
     168         Ticket #1044: Unable to upload c file to marketplace                                    assigned tim defect major 
     169 
     170      It is recommended that all users upgrade to this version, but your attention is drawn to the Changes section above. 
     171 
     172 
     173    - New in Version 4.1.2 
     174      -------------------- 
     175      This point release is a bug-fix release addressing: 
     176 
     177       - Fixes #984: PDF Reports Generate Empty PDFs 
     178       - Fixes a path typo 
     179       - 64 bit and 32 bit Windows executables now available 
     180 
     181      It is recommended that all users upgrade to this version 
     182 
     183 
     184    - New in Version 4.1.1 
     185      -------------------- 
     186      This point release is a bug-fix release addressing: 
     187 
     188       - Fixes #948: Mathjax CDN is going away 
     189       - Fixes #938: Cannot read canSAS1D file output by SasView 
     190       - Fixes #960: Save project throws error if empty fit page 
     191       - Fixes #929: Problem deleting data in first fit page 
     192       - Fixes #918: Test folders not bundled with release 
     193       - Fixes an issue with the live discovery of plugin models 
     194       - Fixes an issue with the NXcanSAS data loader 
     195       - Updated tutorials for SasView 4.x.y 
     196 
     197 
     198    - New in Version 4.1.0 
     199      ------------------ 
     200      This incremental release brings a series of new features and improvements, 
     201      and a host of bug fixes. Of particular note are: 
     202       
     203      - Correlation Function Analysis (Corfunc) 
     204        This performs a correlation function analysis of one-dimensional SAXS/SANS data,  
     205            or generates a model-independent volume fraction profile from the SANS from an  
     206            adsorbed polymer/surfactant layer. 
     207 
     208            A correlation function may be interpreted in terms of an imaginary rod moving  
     209            through the structure of the material. Γ1D(R) is the probability that a rod of  
     210            length R moving through the material has equal electron/neutron scattering  
     211            length density at either end. Hence a frequently occurring spacing within a  
     212            structure manifests itself as a peak. 
     213 
     214            A volume fraction profile \Phi(z) describes how the density of polymer  
     215            segments/surfactant molecules varies with distance from an (assumed locally flat) 
     216            interface. 
     217 
     218      - Fitting of SESANS Data 
     219        Data from Spin-Echo SANS measurements can now be loaded and fitted. The data will  
     220            be plotted against the correct axes and models will automatically perform a Hankel  
     221            transform in order to calculate SESANS from a SANS model. 
     222 
     223      - Documentation 
     224        The documentation has undergone significant checking and updating. 
     225 
     226      - Improvements 
     227        - Correlation function (corfunc) analysis of 1D SAS data added from CCP13 
     228        - File converter tool for multi-file single column data sets 
     229        - SESANS data loading and direct fitting using the Hankel transformation 
     230        - Saving and loading of simultaneous and constrained fits now supported 
     231        - Save states from SasView v3.x.y now loaded using sasmodel model names 
     232        - Saving and loading of projects with 2D fits now supported 
     233        - Loading a project removes all existing data, fits, and plots 
     234        - Structure factor and form factor can be plotted independently 
     235        - OpenCL is disabled by default and can be enabled through a fit menu 
     236        - Data and theory fields are now independently expandable 
     237      - Bug Fixes 
     238        - Fixes #667: Models computed multiple times on parameters changes 
     239        - Fixes #673: Custom models override built in models of same name 
     240        - Fixes #678: Hard crash when running complex models on GPU 
     241        - Fixes $774: Old style plugin models unloadable 
     242        - Fixes #789: stacked disk scale doesn't match cylinder model 
     243        - Fixes #792: core_shell_fractal uses wrong effective radius 
     244        - Fixes #800: Plot range reset on plot redraws 
     245        - Fixes #811 and #825: 2D smearing broken 
     246        - Fixes #815: Integer model parameter handling 
     247        - Fixes #824: Cannot apply sector averaging when no detector data present 
     248        - Fixes #830: Cansas HDF5 reader fully compliant with NXCanSAS v1.0 format 
     249        - Fixes #835: Fractal model breaks with negative Q values 
     250        - Fixes #843: Multilayer vesicle does not define effective radius 
     251        - Fixes #858: Hayter MSA S(Q) returns errors 
     252        - Numerous grammatical and contexual errors in documention 
     253 
     254 
     255    - New in Version 4.0.1 
     256      ------------------ 
     257      This release fixes the critical bug #750 in P(Q)*S(Q).  Most damaging 
     258      it appears that the background term was being added to S(Q) prior to 
     259      multiplication by P(Q). 
     260 
     261 
     262    - New in Version 4.0 
     263      ------------------ 
     264      This release fixes the various bugs found during the alpha and beta testing 
     265      - Improvements 
     266        - Support for reading data files from Anton Paar Saxess instruments 
     267        - Adds documentation on how to write custom models in the new framework 
     268      - Bug Fixes 
     269        - Fixes bug #604 Pringle model questions 
     270        - Fixes bug #472 Reparameterize Teubner-Strey 
     271        - Fixes bug #530 Numerical instabilities in Teubner Strey model 
     272        - Fixes bug #658 ASCII reader very broken 
     273 
     274 
     275    - New in Version 4.0 beta 1 
     276      -------------------- 
     277      This beta adds support for the magnetic and multilevel models of 3.1.2 
     278      and along with a host of bug fixes found in the alpha. 
     279 
     280      - Model package changes and improvements 
     281         - All 3.1.2 models now available in new interface 
     282         - Old custom models should now still work 
     283            - '''NOTE:''' These will be deprecated in a future version. Old 
     284            custom models should be converted to the new model format which 
     285            is now the same as the built in models and offers much better 
     286            support. 
     287         - Custom model editor now creates new style models 
     288         - Custom model editor supports better error checking 
     289      - Documentation improvements 
     290        - Continued general cleanup 
     291      - Other improvements/additions 
     292         - Support for new canSAS 2D data files added 
     293         - Plot axes range can now be set manually as well as by zooming 
     294         - Plot annotations can now be moved around after being placed on plot. 
     295         - The active optimizer is now listed on the top of the fit panel. 
     296         - Linear fits now update qmin and max when the x scale limits are 
     297         changed.  Also the plot range no longer resets after a fit. 
     298      - Bug fixes 
     299         - Fixes bug #511 Errors in linearized fits and clean up of interface 
     300         including Kratky representation 
     301         - Fixes bug #186 Data operation Tool now executes when something is 
     302         entered in the text box and does not wait for the user to hit enter 
     303         - Fixes bug #459 plot context menu bug 
     304         - Fixes bug #559 copy to clipboard in graph menu broken 
     305         - Fixes bug #466 cannot remove a linear fit from graph 
     306         - Numerous bugs introduced in the alpha 
     307 
     308 
     309    - New in Version 4.0.0-alpha 
     310      -------------------- 
     311      This alpha release brings a major overhaul of the model system. The new model 
     312      package allows rapid integration of custom models and access to polydispersity 
     313      without requiring a compiler. 
     314 
     315      - Model package changes and improvements 
     316         - Model interface moved to independent sasmodels package. 
     317         - Most models converted to new interface. 
     318         - Allows rapid integration of user-written models. 
     319         - OpenCL GPU utilization for faster fitting. 
     320         - Improved numerical integration of Bessel functions. 
     321      - SESANS integration and implementation 
     322         - Scripting interface added for analysis of SESANS data. 
     323         - Hankel transformation now accepts finite acceptance angles. 
     324         - 2D cosine transformation added for TOF SESANS analysis. 
     325      - Documentation improvements 
     326         - The documentation tree was restructured for a better end user experience. 
     327         - The documentation for each model was revamped and verified by at least 
     328           two people following the conversion of the model. 
     329         - Theoretical 1D (and 2D if applicable) scattering curves are auto-generated 
     330           and added to the model documentation for each model. 
     331      - Separation of GUI and calculations for future GUI enhancements 
     332      - Bug fixes 
     333         - Fixes bug #411 No stop button on simultaneous fit page 
     334         - Fixes bug #410 Error with raspberry model 
     335         - Fixes bug #364 Possible inconsistency in Poly_GausCoil model 
     336         - Fixes bug #439 Hayter Penfold MSA code needs checking 
     337         - Fixes bug #484 lammellerPC is precision limited 
     338         - Fixes bug #498 $HOME/.matplotlib conflicts 
     339         - Fixes bug #348 Control order in which fit parameters appear in the gui 
     340         - Fixes bug #456 Provide DREAM Results Panel with something to identify 
     341           data and age of results 
     342         - Fixes bug #556 Build script improvements for developers 
     343 
     344 
     345   - New in Version 3.1.2 
    2346     -------------------- 
    3  
     347     This release is a major stability improvement, having fixed a serious bug 
     348     that came to light since release 3.1.1. All users should upgrade. 
     349 
     350     - Fixes bug #468 broken remove constraint buttons in 
     351       simultaneous/constrained fitting panel 
     352     - Fixes bug #474 resulting from changes in 3.1.1 that had 
     353       introduced an error in the high-Q of slit-smeared models. 
     354     - Fixes bug #478 which would cause wx to run out of IDs and result 
     355       in SasView crashing even if left alone. 
     356     - Fixes bug #479 missing help button on simultaneous/constrained fit page 
     357     - Fixes bug #480 GUI resizing issues on simultaneous fit page 
     358     - Fixes bug #486 broken Report Results 
     359     - Fixes bug #488 redraw issues in fit page 
     360 
     361 
     362   - New in Version 3.1.1 
     363     -------------------- 
     364     - Fixes bug #457 that prevented SasView from starting if the user was not 
     365       connected to the internet, or was behind a proxy server. 
     366 
     367 
     368   - New in Version 3.1.0 
     369     -------------------- 
     370     - The documentation/help has had a complete overhaul including: 
     371       - A completely new presentation interface (Sphinx). 
     372       - Proof reading! 
     373       - Updating for latest features. 
     374       - A Help (or sometimes ?) button has been added to every panel, and some 
     375         sub panels if appropriate, linking to the appropriate section in the 
     376         documentation. 
     377       - The model help has been split so that the Details button now brings up 
     378         a very short pop-up giving the equation being used while HELP goes to 
     379         the section in the full documentation describing the model. 
     380       - Extensive help has also been added for the new optimizer engine (see 
     381         below) including rules of thumb on how and when to choose a given 
     382         optimizer and what the parameters do. 
     383     - The optimizer engine has been completely replaced. The new optimizer 
     384       still defaults to the standard Levenberg-Marquardt algorithm. However 4 
     385       other optimizers are now also available. Each starts with a set of default 
     386       parameters which can be tuned. The DREAM optimizer takes the longest but 
     387       is the most powerful and yields rich information including full parameter 
     388       correlation and uncertainty plots. A results panel has been added to 
     389       accommodate this. 
     390       - The five new optimizers are: 
     391         - A Levenberg-Marquardt optimizer 
     392         - A Quasi-Newton BFGS optimizer 
     393         - A Nelder-Mead Simplex optimizer 
     394         - A Differential Evolution optimizer 
     395         - A Monte Carlo optimizer (DREAM) 
    4396     - New models were added: 
    5        - LamellarPolLz 
    6  
     397         - MicelleSphCoreModel (currently residing in the Uncategorized category) 
    7398     - Existing models were updated: 
    8        - LamellarPS and LamellarPSHG have been changed to LamellarCaille and  
    9          LamellarCailleHG 
    10         
     399         - LamellarPS (bug in polydispersity integration fixed) 
     400         - RectangularPrismModel 
     401         - RectangularHollowPrismModel 
     402         - RectangularHollowPrismInfThinWallsModel 
     403     - Infrastructure to allow SESANS data to be fit with models was added. This 
     404       will become available in a future release but can currently be used from 
     405       the command line with some caveats. 
     406     - A number of bugs were fixed including a thread crashing issue and an 
     407       incorrect slit smearing resolution calculation. 
     408     - Implemented much more robust error logging to enable much easier 
     409       debugging in general but particularly the debugging of issues reported by 
     410       SasView users. 
     411     - A number of infrastructure tasks under the hood to enhance maintainability 
     412     - Upgrade from Wx 2.8 to Wx 3.0.2 which allows several new features but 
     413       required significant additional rework as well. 
     414     - Fully implemented Sphinx to the build process to produce both better 
     415       user documentation and developer documentation. 
     416     - Restructuring of the code base to more unified nomenclature and structure 
     417       so that the source installation tree more closely matches the installer 
     418       version tree. 
     419     - Code cleanup (an ongoing task) . 
     420     - Migration of the repository to github simplifying contributions from 
     421       non-project personnel through pull requests. 
     422 
     423 
     424   - New in Version 3.0.0 
     425     -------------------- 
     426     - The GUI look and feel has been refactored to be more familiar for 
     427       Windows users by using MDI frames. Graph windows are also now free- 
     428       floating. 
     429     - Five new models have been added: PringlesModel, CoreShellEllipsoidXTModel, 
     430       RectangularPrismModel, RectangularHollowPrismModel and 
     431       RectangularHollowPrismInfThinWallsModel. 
     432     - The data loader now supports ILL DAT data files and reads the full meta 
     433       information from canSAS file formats. 
     434     - Redefined convention for specifying angular parameters for anisotropic 
     435       models. 
     436     - A number of minor features have been added such as permitting a log 
     437       distribution of points when using a model to simulate data, and the 
     438       addition of a Kratky plot option to the linear plots. 
     439     - A number of bugs have also been fixed. 
     440     - Save Project and Save Analysis now work more reliably. 
     441     - BETA: Magnetic contrast supporting full polarization analysis has been 
     442       implemented for some spherical and cylindrical models. 
     443     - BETA: Two new tools have been added: 
     444       - A generic scattering calculator which takes an atomic, magnetic or 
     445         SLD distribution in space and generates the appropriate 2D 
     446         scattering pattern. In some cases the orientationally averaged 
     447         (powder) 1D scattering can also be computed. Supported formats 
     448         include: SLD or text, PDB, and OMF magnetic moment distribution 
     449         file. 
     450       - An image viewer/converter for data in image format; this reads in 
     451         an image file and will attempt to convert the image pixels to 
     452         data. Supported formats include: TIFF, TIF, PNG, BMP, JPG. 
     453 
     454 
     455   - New in Version 2.2.1 
     456     -------------------- 
     457     - Minor patch to support CanSAS XML v1.1 file format 
     458     - Added DataInfo for data in the DataExplorer and plots 
     459     - Added Maximize/Restore button in the title bar of the graphs 
     460     - Added a hide button in the toolbar of the graph panel 
     461     - The 'x' button now deletes a graph 
     462     - Edit SUM Model from the menubar can now generate and save more than one sum model 
     463     - Reports can now be saved in pdf format on WIN and MAC 
     464     - Made significant improvements to the batch/grid panel and fixed several bugs 
     465     - Fixed a number of other minor bugs 
     466 
     467 
     468   - New in Version 2.2.0 
     469     -------------------- 
     470     - Application name changed to SasView 
     471     - New fully customizable Category Manager added for better management of 
     472       increasing number of models 
     473     - Improved the Grid Window functionality in the batch fitting mode 
     474     - Added a simpler Graph/Plot modification interface 
     475     - Added a new 'Data Operation' tool for addition, subtraction, multiplication, 
     476       division, of two data sets. 
     477     - The 'Sum Model' editor was extended and renamed 'Summation and Multiplication' 
     478       editor 
     479     - Added more plot symbols options for 1d plots 
     480     - Added improved trapping of compiling errors to the 'New model editor' 
     481     - Added some intelligent outputs (e.g., Rg, background, or rod diameter 
     482       depending on the choice of axis scale of the plot) to the linear fits 
     483     - Added more models 
     484 
     485   - Feature set from previous versions 
     486     ----------------------------------- 
     487     - Perspectives Available 
     488       - Invariant calculator: Calculates the invariant, volume fraction, and 
     489         specific surface area. 
     490       - P(r) inversion calculator: Indirect Fourier transformation method. 
     491       - Fitting: the tool used for modeling and fitting 1D and 2D data to 
     492         analytical model functions 
     493       - Tools: provides a number of useful supplementary tools such as SLD 
     494         calculation 
     495 
     496     - Fitting 
     497       - Includes a large number of model functions, both form factors and structure factors. 
     498       - Support P(Q)*S(Q) for form factors that flag they can be so multiplied. 
     499       - Supports Gaussian, lognormal, Shulz, rectangular and custom distribution 
     500         functions for models that need to include polydispersity or for orientational 
     501         distributions if appropriate. 
     502       - Anisotropic shapes and magnetic moment modeling in 2D allow for a non-uniform 
     503         distribution of orientations of a given axis leading to modeling and fitting 
     504         capabilities of non azimuthaly symmetric data. 
     505       - User can choose to weight fits or not. If using weights, the user can choose 
     506         the error bar on each point if provided in the file, the square root 
     507         of the intensity or the intensity itself. 
     508       - Instrumental resolution smearing of model or fits is provided with several 
     509         options: read the resolution/point fromt he file. Input a pinhole resolution 
     510         or a slit resolution. 
     511       - Users can define the Qrange (Qmin and Qmax) for both 1D and 2D data for 
     512         fitting and modeling, but not graphically.  The range can be reset to the 
     513         defaults (limits of q in data set for a fit) with the reset button. 
     514       - A mask can be applied to 2D calculation and fitting. 
     515       - Normalized residual plots are provided with every fit. 
     516       - Model function help available through detail button or from the fitting panel. 
     517       - Simultaneous/(advanced)constrained fitting allows for fitting a single 
     518         data set or several different sets simultaneously with the application 
     519         of advanced constraints relating fit parameters to functions of other 
     520         parameters (including from a different set). For example thickness of 
     521         shell = sin(30) times the length. 
     522       - Models that are the sum of two other models can be easily generated through the 
     523         SUM Model menubar item. 
     524       - New Python models can be added on the fly by creating an appropriate Python 
     525         file in the model plugin directory. Two tools are provided to help: 
     526         An easy to use custom model editor allows the quick generation of new Python 
     527         models by supplying only the parameters and their default value (box 1) 
     528         and the mathematical function of the model (box 2) and generating the 
     529         necessary *.py file.  A separate advanced model editor provides a full Python 
     530         file editor.  Either way once saved the model becomes immediately available 
     531         to the application. 
     532       - A batch fitting capability allows for the analysis of a series of data sets to 
     533         a single model and provides the results in a tabular form suitable for saving 
     534         or plotting the evolution of the fit parameters with error bars (from within 
     535         the application). 
     536 
     537     - Tools 
     538       - A scattering length density calculator,including some X-ray information 
     539         is provided. 
     540       - A density to vol. fraction converter is provided 
     541       - In application access to a Python shell/editor (PyCrust) is provided 
     542       - An instrument resolution calculator, including possible gravitational and 
     543         TOF effects is provided 
     544       - A slit size calculator optimized for Anton Paar Saxess is provided. 
     545       - A kiessig fringe thickness calculator is provided 
     546 
     547     - Plots and plot management 
     548       - A 3D graphing option (for 2d data/results) is provided with the view 
     549         controlled by the mouse 
     550       - 2D plots are shown with an intensity color bar. 2D Color map can be user 
     551         adjusted. 
     552       - Supports output of plot to a variety of graphic formats. Supported formats 
     553         include: png, eps, emf, jpg/jpeg, pdf, ps, tif/tiff, rawRGBbitmap(raw, rgba), 
     554         and scalable vector graphic (svg/svgz) 
     555       - Supports ouput of data in plot (1 or 2D) to limited data formats 
     556       - Multiple data sets can be loaded into a single graph for viewing (but a fit 
     557         plot can currently only have a single plot). 
     558       - Extensive context sensitive plot/fitting/manipulation options are available 
     559         through a right mouse click pop-up menu on plots. 
     560 
     561     - Data management 
     562       - Supports 2 + column 1D ASCII data, NIST 1D and 2D data, and canSAS data 
     563         via plug-in mechanism which can easily allow other readers as appropriate. 
     564       - 2D data is expected in Q space but for historical reasons accepts the 
     565         NIST 2D raw pixel format and will do conversion internally. 
     566       - The full data and metadata available to SasView is viewable in ASCII via 
     567         right clicking on a data set and choosing Data Info in the DataExplorer 
     568         or on the plots 
     569       - Supports loading a single file, multiple files, or a whole folder 
     570       - An optional Data Explorer is provided (default) which simplifies managing, 
     571         plotting, deleting, or setup for computation. Most functions however do 
     572         not require access to the explorer/manager and can be accessed through 
     573         right click menus and the toolbar.  The data explorer can be re-started 
     574         from the menu bar. 
     575 
     576     - Data manipulation 
     577       - Support various 2D averaging methods : Circular, sectors, annular, 
     578         boxsum, boxQx and boxQy. 
     579       - A 2D data maks editor is provided 
     580       - 2D mask can be applied to the circular averaging. 
     581 
     582     - Miscellaneous features 
     583       - limited reports can be generated in pdf format 
     584       - Provides multiprocessor support(Windows only) 
     585       - Limited startup customization currently includes default startup 
     586         data folder and choice of default starting with data manager 
     587       - Limited support for saving(opening) a SasView project or a SasView analysis 
     588         (subproject) is provided. 
     589       - SasView can be launched and loaded with a file of interesty by double-clicking 
     590         on that file (recognized extension) 
     591       - A data file or data folder can be passed to SasView when launched from 
     592         the command line. 
     593       - Limited bookmarking capability to later recall the results of a fit calculation 
     594         is provided. 
     595       - Extensive help is provided through context sensitive mouse roll-over, 
     596         information bar (at the bottom of the panel), the console menu, and 
     597         access to the help files in several different ways. 
     598 
     599 
     6002- Downloading and Installing 
     601============================= 
     602 
     603   *** Note 1:  Much more information is available at www.sasview.org under links. 
     604                    Look in the 'For Developers' section and particularly the wiki at 
     605                www.sasview.org/trac/wiki. 
     606   *** Note 2:  If you have EXE or ZIP SasView installer, you won't need any of 
     607                the following.  However it is highly recommended that any 
     608                previous versions be un-installed prior to installing the 
     609                new version. 
     610 
     611   2.1- System Requirements 
     612        - Python version >= 2.5 and < 3.0 should be running on the system 
     613        - We currently use Python 2.7 
     614 
     615   2.2- Installing from source 
     616        - Get the source code 
     617          - to follow the current development version from source control use 
     618              git clone https://github.com/SasView/sasview.git 
     619              git clone https://github.com/bumps/bumps.git 
     620          - to install a specific version 
     621 
     622        - Build, install and run a specific release 
     623          - make sure the requirements below are already installed 
     624          - retrieve the source from https://github.com/SasView/sasview/releases 
     625          - open a command line window in the 'sasview-x.x.x' directory 
     626          - run 'python setup.py install' 
     627          - run 'python sasview.py' under the 'sasview' folder. 
     628 
     629        - Build, install and run the current development version 
     630          - clone the source from git; also clone bumps, which is developed in parallel 
     631              git clone https://github.com/SasView/sasview.git 
     632              git clone https://github.com/bumps/bumps.git 
     633          - open a command line window in the 'sasview' directory 
     634          - run 'python setup.py build' 
     635          - run 'python run.py'; this runs from the source directories, so you 
     636            don't have to rebuild every time you make a change, unless you are 
     637            changing the C++ model files 
     638 
     639        - The following modules are required (version numbers are what are used 
     640          in the windows release build): 
     641 
     642          - Common Packages 
     643            - reportlab 3.1.44 
     644            - lxml 3.4.4.0 (MAC 3.4.2.0) 
     645            - PIL 1.1.7 
     646            - xhtml2pdf 3.0.33 (MAC = not installed on build server) 
     647            - unittest-xml-reporting 1.12.0 (MAC 1.10.0) 
     648            - matplotlib Version Installed: 1.4.3 (MAC 1.1.1) 
     649            - bumps Version Installed: 0.7.5.9 
     650            - scipy Version Installed: 0.16.0b2 (MAC 0.11.0) 
     651            - periodictable Version Installed: 1.4.1 
     652            - setuptools Version Installed: 7.0 (MAC 12.0.5) 
     653            - sphinx Version Installed: 1.3.1 (MAC 1.3b2) 
     654            - pyparsing Version Installed: 2.0.3 
     655            - numpy Version Installed: 1.9.2 (MAC 1.6.2) 
     656            - html5lib Version Installed: 0.99999 
     657            - wx Version Installed: 3.0.2.0 
     658 
     659          - Windows Specific Packages 
     660            - pywin 219 
     661            - py2exe 0.6.9 
     662            - comtypes 1.1.1 
     663            - MinGW w/ gcc version 4.6.1 (WIN) 
     664            - vcredist_x86.exe (version 9.0.21022.8  -microsoft visual C 2008 
     665              re-distributable) 
     666            - Innosetup (WIN - isetup 5.4.2-unicode) - used to create distributable 
     667 
     668            *** Note: Windows build dependencies can be set up using anaconda. Instructions 
     669                can be found at http://trac.sasview.org/wiki/AnacondaSetup 
     670 
     671          - MAC Specifc Packages 
     672            - py2app 0.7.1 
     673 
     674 
     6753- Known Issues 
     676=============== 
     677 
     678   4.1- All systems: 
     679      The conversion to sasmodels infrastructure is ongoing and should be 
     680      completed in the next release. In the meantime this leads to a few known 
     681      issues: 
     682        - The way that orientation is defined is being refactored to address 
     683        long standing issues and comments.  In release 4.1 however only models 
     684        with symmetry (e.g. a=b) have been converted to the new definitions. 
     685        The rest (a <> b <> c - e.g. parellelepiped) maintain the same 
     686        definition as before and will be converted in 4.2.  Note that 
     687        orientational distribution also makes much more sense in the new 
     688        framework.  The documentation should indicate which definition is being 
     689        used for a given model. 
     690        - The infrastructure currently handles internal conversion of old style 
     691        models so that user created models in previous versions should continue 
     692        to work for now. At some point in the future such support will go away. 
     693        Everyone is encouraged to convert to the new structure which should be 
     694        relatively straight forward and provides a number of benefits.  
     695        - In that vein, the distributed models and those generated by the new 
     696        plugin model editor are in the new format, however those generated by 
     697        sum|multiply models are the old style sum|multiply models. This should 
     698        also disappear in the near future  
     699        - The on the fly discovery of plugin models and changes thereto behave 
     700        inconsistently.  If a change to a plugin model does not seem to 
     701        register, the Load Plugin Models (under fitting -> Plugin Model 
     702        Operations) can be used.  However, after calling Load Plugin Models, the 
     703        active plugin will no longer be loaded (even though the GUI looks like 
     704        it is) unless it is a sum|multiply model which works properly.  All 
     705        others will need to be recalled from the model dropdown menu to reload 
     706        the model into the calculation engine.  While it might be annoying it 
     707        does not appear to prevent SasView from working.. 
     708        - The model code and documentation review is ongoing. At this time the 
     709        core shell parellelepiped is known to have the C shell effectively fixed 
     710        at 0 (noted in documentation) while the triaxial ellipsoid does not seem 
     711        to reproduce the limit of the oblate or prolate ellipsoid. If errors are 
     712        found and corrected, corrected versions will be uploaded to the 
     713        marketplace.  
     714    
     715   3.1- All systems: 
     716        - The documentation window may take a few seconds to load the first time 
     717          it is called. Also, an internet connection is required before 
     718          equations will render properly. Until then they will show in their 
     719          original TeX format. 
     720        - If the documentation window remains stubbornly blank, try installing a 
     721          different browser and set that as your default browser. Issues have 
     722          been noted with Internet Explorer 11. 
     723        - Check for Updates may fail (with the status bar message ' Cannot 
     724          connect to the application server') if your internet connection uses 
     725          a proxy server. Tested resolutions for this are described on the 
     726          website FAQ. 
     727        - The copy and paste functions (^C, ^V) in the batch mode results grid 
     728          require two clicks: one to select the cell and a second to select the 
     729          contents of the cell. 
     730        - The tutorial has not yet been updated and is somewhat out of date 
     731        - Very old computers may struggle to run the 3.x and later releases 
     732        - Polydispersity on multiple parameters included in a simultaneous/ 
     733          constrained fit will likely not be correct 
     734        - Constrained/simultaneous fit page does not have a stop button 
     735        - Constrained/simultaneous fit do not accept min/max limits 
     736        - Save project does not store the state of all the windows 
     737        - Loading projects can be very slow 
     738        - Save Project only works once a data set has been associated with 
     739          a model.  Error is reported on status bar. 
     740        - There is a numerical precision problem with the multishell model when 
     741          the iner radius gets large enough (ticket #288) 
     742        - The angular distribution angles are not clearly defined and may in 
     743          some cases lead to incorrect calculations(ticket #332) 
     744 
     745   3.2- Windows: 
     746        - If installed to same directory as old version without first removing 
     747          the old version, the old desktop icon will remain but point to the 
     748          new exe version. Likewise all the start menu folders and items will 
     749          have the old name even though pointing to the new version.  Usually 
     750          safest to uninstall old version prior to installing new version anyway. 
     751 
     752   3.3- MAC: 
     753        - Application normally starts up hidden. Click icon in Dock to view/use 
     754          application. 
     755        - Multiprocessing does not currently work on MAC OS 
     756 
     757   3.4- Linux: 
     758        - Not well tested 
     759 
     760 
     7614- SasView website 
     762================== 
     763 
     764   - www.sasview.org.  This main project site is the gateway to all 
     765     information about the sasview project.  It includes information 
     766     about the project, a FAQ page and links to all developer and user 
     767     information, tools and resources. 
     768 
     769 
     7705- Frequently Asked Questions 
     771============================= 
     772 
     773   - www.sasview.org/faq.html 
     774 
     775 
     7766- Installer download website 
     777============================= 
     778 
     779   - Latest release Version 
     780     - https://github.com/SasView/sasview/releases 
     781   - Latest developer builds 
     782     - https://jenkins.esss.dk/sasview/view/Master-Builds/ 
  • installers/README.txt

    r724af06 r2b07b6d  
    11Release Notes 
    22============= 
    3  
     3    This is a beta pre-release version of 4.2.0.  A number of fixes and changes 
     4    have been made in the year since the previous release.   
     5    Full release notes will be compiled prior to the full release 4.2.0. 
     6     
     7    Highlights are: 
     8        - Infrastucture for calculating 2D patterns from 3D orientated objects 
     9          has now been totally refactored 
     10        - Plugins have completely migrated to the new infrastructure now,  
     11          including sum/multiply models 
     12        - Some batch slicing options have been introduced 
     13        - The known issue with the core_shell_parallelepiped is now fixed 
     14        - Several data loading improvements 
     15        - Several save Project improvements (though there are more to come) 
     16        - Numerous bug fixes 
     17        - Lots of documentation enhancement 
     18     
     19    In the meantime please report any bugs or issues found while using this beta 
     20     
    4211- Features 
    522=========== 
  • src/sas/sascalc/dataloader/readers/abs_reader.py

    r3bab401 r35ac8df  
    171171 
    172172                try: 
    173                     _x = float(toks[0]) 
     173                    _x = float(toks[4]) 
    174174                    _y = float(toks[1]) 
    175175                    _dy = float(toks[2]) 
  • src/sas/sascalc/fit/pagestate.py

    r3b070a0 r59873e1  
    1313################################################################################ 
    1414import time 
     15import re 
    1516import os 
    1617import sys 
     
    962963        if node.get('version'): 
    963964            # Get the version for model conversion purposes 
    964             self.version = tuple(int(e) for e in 
    965                                  str.split(node.get('version'), ".")) 
     965            x = re.sub('[^\d.]', '', node.get('version')) 
     966            self.version = tuple(int(e) for e in str.split(x, ".")) 
    966967            # The tuple must be at least 3 items long 
    967968            while len(self.version) < 3: 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py

    ra26f67f ra20a255  
    251251            self.bck.Add(self.batch_slicer_button, (iy, ix), (1, 1), 
    252252                         wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
     253            # Help button 
     254 
     255            self.bt_help = wx.Button(self, wx.NewId(), "HELP") 
     256            self.bt_help.SetToolTipString( 
     257                "Help for the slicer parameters and batch slicing.") 
     258            self.bck.Add(self.bt_help, (iy, 1), (1, 1), 
     259                         wx.ALIGN_RIGHT | wx.ADJUST_MINSIZE, 15) 
     260            wx.EVT_BUTTON(self, self.bt_help.GetId(), self.on_help) 
     261 
    253262            iy += 1 
    254263            self.bck.Add((5, 5), (iy, ix), (1, 1), 
    255264                         wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 
     265 
    256266        self.bck.Layout() 
    257267        self.bck.Fit(self) 
     
    535545            self.default_value += "_{0}".format(key).split(" [")[0] 
    536546            self.default_value += "-{:.2f}".format(params[key]) 
     547 
     548    def on_help(self, event=None): 
     549        """ 
     550        Opens a help window for the slicer parameters/batch slicing window 
     551        :param event: 
     552        :return: 
     553        """ 
     554        from sas.sasgui.guiframe.documentation_window import DocumentationWindow 
     555 
     556        _TreeLocation = "user/sasgui/guiframe/graph_help.html" 
     557        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 
     558                                          "#d-data-averaging", 
     559                                          "Data Explorer Help") 
  • src/sas/sasgui/guiframe/media/graph_help.rst

    r5ed76f8 rde68f78  
    266266 
    267267.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     268.. _d_data_averaging: 
    268269 
    2692702D data averaging 
     
    301302Alternatively, once a 'slicer' is active you can also select the region to 
    302303average by bringing back the *Dataset Menu* and selecting *Edit Slicer 
    303 Parameters*. A dialog window will appear in which you can enter values to 
    304 define a region or select the number of points to plot (*nbins*). 
     304Parameters and Batch Fitting*. A dialog window will appear in which you can 
     305enter values to define a region, select the number of points to plot (*nbins*), 
     306or apply the slicer to any or all other 2D data plots. 
    305307 
    306308A separate plot window will also have appeared, displaying the requested 
     
    315317 
    316318To remove a 'slicer', bring back the *Dataset menu* and select *Clear Slicer*. 
     319 
     320Batch Slicing 
     321^^^^^^^^^^^^^ 
     322 
     323A slicer can be applied to any or all existing 2D data plots using the 'Slicer 
     324Parameters' window. To open the window, select *Edit Slicer Parameters and Batch 
     325Fitting* in the *Dataset Menu* (see Invoking_the_dataset_menu_). Batch slicing 
     326options are available at the bottom of the window. 
     327 
     328Select the 2D plots you want to apply the slicer to. All 2D plots are selected 
     329by default. The resulting 1D data for all slicers can be saved as a text file 
     330and then sent to fitting by selecting the *Auto save generated 1D* check box. 
     331Sending data to the fitting perspective requires the data be saved. 
     332 
     333Once the auto save check box is selected, you can select where the files are 
     334saved. The file name for the saved data is the slicer name plus the file name 
     335of the original data set, plus what is in the *Append to file name* field. The 
     336default value in the append to field includes the names and values for all of 
     337the slicer parameters. 
     338 
     339The batch of slices can be sent to fitting if desired, with three options 
     340available. The first is to not fit the data, the second is to send the 
     341slices to individual fit pages, and the third is to send all sliced data to a 
     342single batch fit window. 
     343 
     344Clicking *Apply Slicer to Selected Plots* will create a slicer for each selected 
     345plot with the parameters entered in the 'Slicer Parameters' window. Depending on 
     346the options selected the data may then be saved, loaded as separate data sets in 
     347the data manager panel, and finally sent to fitting. 
    317348 
    318349Unmasked circular average 
  • src/sas/sasgui/perspectives/calculator/pyconsole.py

    r4627657 re2663b7  
    2828    Check that the model on the path can run. 
    2929    """ 
     30    # TODO: fix model caching 
     31    # model_test.run_one() is directly forcing a reload of the module, but 
     32    # sasview_model is caching models that have already been loaded. 
     33    # If the sasview load happens before the test, then the module is 
     34    # reloaded out from under it, which causes the global variables in 
     35    # the model function definitions to be cleared (at least in python 2.7). 
     36    # To fix the proximal problem of models failing on test, perform the 
     37    # run_one() tests first.  To fix the deeper problem we should either 
     38    # remove caching from sasmodels.sasview_model.load_custom_model() or 
     39    # add caching to sasmodels.custom.load_custom_kernel_module().  Another 
     40    # option is to add a runTests method to SasviewModel which runs the 
     41    # test suite directly from the model info structure.  Probably some 
     42    # combination of options: 
     43    #    (1) have this function (check_model) operate on a loaded model 
     44    #    so that caching isn't needed in sasview_models.load_custom_model 
     45    #    (2) add the runTests method to SasviewModel so that tests can 
     46    #    be run on a loaded module. 
     47    # 
     48    # Also, note that the model test suite runs the equivalent of the 
     49    # "try running the model" block below, and doesn't need to be run 
     50    # twice.  The reason for duplicating the block here is to generate 
     51    # an exception that show_model_output can catch.  Need to write the 
     52    # runTests method so that it returns success flag as well as output 
     53    # string so that the extra test is not necessary. 
     54 
     55    # check the model's unit tests run 
     56    from sasmodels.model_test import run_one 
     57    result = run_one(path) 
     58 
     59    # remove cached version of the model, if any 
     60    from sasmodels import sasview_model 
     61    sasview_model.MODEL_BY_PATH.pop(path, None) 
     62 
    3063    # try running the model 
    31     from sasmodels.sasview_model import load_custom_model 
    32     Model = load_custom_model(path) 
     64    Model = sasview_model.load_custom_model(path) 
    3365    model = Model() 
    3466    q =  np.array([0.01, 0.1]) 
     
    3668    qx, qy =  np.array([0.01, 0.01]), np.array([0.1, 0.1]) 
    3769    Iqxy = model.evalDistribution([qx, qy]) 
    38  
    39     # check the model's unit tests run 
    40     from sasmodels.model_test import run_one 
    41     result = run_one(path) 
    4270 
    4371    return result 
  • src/sas/sasgui/perspectives/calculator/slit_length_calculator_panel.py

    r7432acb rd788619  
    248248            Complete the loading and compute the slit size 
    249249        """ 
     250        if isinstance(data, list): 
     251            data = data[0] 
    250252        if data is None or data.__class__.__name__ == 'Data2D': 
    251253            if self.parent.parent is None: 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rc192960 r8a51dea0  
    25522552            # draw 
    25532553            self._draw_model() 
     2554            self.Layout() 
    25542555            self.Refresh() 
    25552556        except Exception: 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    ra7c6f38 rdabcaf7  
    706706 
    707707                        ix = 3 
    708                         ctl2 = wx.TextCtrl(self, wx.ID_ANY, 
    709                                            size=(_BOX_WIDTH / 1.3, 20), 
    710                                            style=0) 
     708                        ctl2 = BGTextCtrl(self, wx.ID_ANY, 
     709                                           size=(_BOX_WIDTH / 1.3, 20)) 
    711710 
    712711                        self.sizer4_4.Add(ctl2, (iy, ix), (1, 1), 
     
    19981997        self.on_smear_helper() 
    19991998        self.on_set_focus(None) 
     1999        self.Layout() 
    20002000        self.Refresh() 
    20012001        # update model plot with new data information 
     
    28922892                        text2.Hide() 
    28932893                    ix += 1 
    2894                     ctl2 = wx.TextCtrl(self, wx.ID_ANY, 
    2895                                        size=(_BOX_WIDTH / 1.2, 20), style=0) 
     2894                    ctl2 = BGTextCtrl(self, wx.ID_ANY, 
     2895                                       size=(_BOX_WIDTH / 1.2, 20)) 
    28962896                    sizer.Add(ctl2, (iy, ix), (1, 1), 
    28972897                              wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
  • src/sas/sasview/__init__.py

    r3ca67dcf ra8bbba2  
    1 __version__ = "4.2.0" 
     1__version__ = "4.2.0-beta" 
    22__build__ = "GIT_COMMIT" 
  • test/sasdataloader/test/utest_abs_reader.py

    rfc51d06 r35ac8df  
    5353 
    5454        self.assertEqual(self.data.y_unit, 'cm^{-1}') 
    55         self.assertEqual(self.data.x[0], 0.002618) 
    56         self.assertEqual(self.data.x[1], 0.007854) 
    57         self.assertEqual(self.data.x[2], 0.01309) 
     55        self.assertEqual(self.data.x[0], 0.008082) 
     56        self.assertEqual(self.data.x[1], 0.0275) 
     57        self.assertEqual(self.data.x[2], 0.02762) 
    5858        self.assertEqual(self.data.x[126], 0.5828) 
    5959 
  • src/sas/sascalc/data_util/nxsunit.py

    r574adc7 rb011ecb  
    136136    sld = { '10^-6 Angstrom^-2': 1e-6, 'Angstrom^-2': 1 } 
    137137    Q = { 'invA': 1, 'invAng': 1, 'invAngstroms': 1, '1/A': 1, 
     138          '1/Angstrom': 1, '1/angstrom': 1, 'A^{-1}': 1, 'cm^{-1}': 1e-8, 
    138139          '10^-3 Angstrom^-1': 1e-3, '1/cm': 1e-8, '1/m': 1e-10, 
    139           'nm^-1': 0.1, '1/nm': 0.1, 'n_m^-1': 0.1 } 
     140          'nm^{-1}': 1, 'nm^-1': 0.1, '1/nm': 0.1, 'n_m^-1': 0.1 } 
    140141 
    141142    _caret_optional(sld) 
     
    157158    # units for that particular dimension. 
    158159    # Note: don't have support for dimensionless units. 
    159     unknown = {None:1, '???':1, '': 1, 'a.u.': 1} 
     160    unknown = {None:1, '???':1, '': 1, 'a.u.': 1, 'Counts': 1, 'counts': 1} 
    160161 
    161162    def __init__(self, name): 
  • src/sas/sascalc/dataloader/file_reader_base_class.py

    r4a8d55c r8f882fe  
    1616from .data_info import Data1D, Data2D, DataInfo, plottable_1D, plottable_2D,\ 
    1717    combine_data_info_with_plottable 
     18from sas.sascalc.data_util.nxsunit import Converter 
    1819 
    1920logger = logging.getLogger(__name__) 
     
    9899                    if len(self.output) > 0: 
    99100                        # Sort the data that's been loaded 
    100                         self.sort_one_d_data() 
    101                         self.sort_two_d_data() 
     101                        self.convert_data_units() 
     102                        self.sort_data() 
    102103        else: 
    103104            msg = "Unable to find file at: {}\n".format(filepath) 
     
    166167        self.output.append(data_obj) 
    167168 
    168     def sort_one_d_data(self): 
     169    def sort_data(self): 
    169170        """ 
    170171        Sort 1D data along the X axis for consistency 
     
    174175                # Normalize the units for 
    175176                data.x_unit = self.format_unit(data.x_unit) 
     177                data._xunit = data.x_unit 
    176178                data.y_unit = self.format_unit(data.y_unit) 
     179                data._yunit = data.y_unit 
    177180                # Sort data by increasing x and remove 1st point 
    178181                ind = np.lexsort((data.y, data.x)) 
     
    203206                    data.ymin = np.min(data.y) 
    204207                    data.ymax = np.max(data.y) 
     208            elif isinstance(data, Data2D): 
     209                # Normalize the units for 
     210                data.Q_unit = self.format_unit(data.Q_unit) 
     211                data.I_unit = self.format_unit(data.I_unit) 
     212                data._xunit = data.Q_unit 
     213                data._yunit = data.Q_unit 
     214                data._zunit = data.I_unit 
     215                data.data = data.data.astype(np.float64) 
     216                data.qx_data = data.qx_data.astype(np.float64) 
     217                data.xmin = np.min(data.qx_data) 
     218                data.xmax = np.max(data.qx_data) 
     219                data.qy_data = data.qy_data.astype(np.float64) 
     220                data.ymin = np.min(data.qy_data) 
     221                data.ymax = np.max(data.qy_data) 
     222                data.q_data = np.sqrt(data.qx_data * data.qx_data 
     223                                         + data.qy_data * data.qy_data) 
     224                if data.err_data is not None: 
     225                    data.err_data = data.err_data.astype(np.float64) 
     226                if data.dqx_data is not None: 
     227                    data.dqx_data = data.dqx_data.astype(np.float64) 
     228                if data.dqy_data is not None: 
     229                    data.dqy_data = data.dqy_data.astype(np.float64) 
     230                if data.mask is not None: 
     231                    data.mask = data.mask.astype(dtype=bool) 
     232 
     233                if len(data.data.shape) == 2: 
     234                    n_rows, n_cols = data.data.shape 
     235                    data.y_bins = data.qy_data[0::int(n_cols)] 
     236                    data.x_bins = data.qx_data[:int(n_cols)] 
     237                    data.data = data.data.flatten() 
     238                    data = self._remove_nans_in_data(data) 
     239                if len(data.data) > 0: 
     240                    data.xmin = np.min(data.qx_data) 
     241                    data.xmax = np.max(data.qx_data) 
     242                    data.ymin = np.min(data.qy_data) 
     243                    data.ymax = np.max(data.qx_data) 
    205244 
    206245    @staticmethod 
     
    242281        return data 
    243282 
    244     def sort_two_d_data(self): 
    245         for dataset in self.output: 
    246             if isinstance(dataset, Data2D): 
    247                 # Normalize the units for 
    248                 dataset.x_unit = self.format_unit(dataset.Q_unit) 
    249                 dataset.y_unit = self.format_unit(dataset.I_unit) 
    250                 dataset.data = dataset.data.astype(np.float64) 
    251                 dataset.qx_data = dataset.qx_data.astype(np.float64) 
    252                 dataset.xmin = np.min(dataset.qx_data) 
    253                 dataset.xmax = np.max(dataset.qx_data) 
    254                 dataset.qy_data = dataset.qy_data.astype(np.float64) 
    255                 dataset.ymin = np.min(dataset.qy_data) 
    256                 dataset.ymax = np.max(dataset.qy_data) 
    257                 dataset.q_data = np.sqrt(dataset.qx_data * dataset.qx_data 
    258                                          + dataset.qy_data * dataset.qy_data) 
    259                 if dataset.err_data is not None: 
    260                     dataset.err_data = dataset.err_data.astype(np.float64) 
    261                 if dataset.dqx_data is not None: 
    262                     dataset.dqx_data = dataset.dqx_data.astype(np.float64) 
    263                 if dataset.dqy_data is not None: 
    264                     dataset.dqy_data = dataset.dqy_data.astype(np.float64) 
    265                 if dataset.mask is not None: 
    266                     dataset.mask = dataset.mask.astype(dtype=bool) 
    267  
    268                 if len(dataset.data.shape) == 2: 
    269                     n_rows, n_cols = dataset.data.shape 
    270                     dataset.y_bins = dataset.qy_data[0::int(n_cols)] 
    271                     dataset.x_bins = dataset.qx_data[:int(n_cols)] 
    272                 dataset.data = dataset.data.flatten() 
    273                 dataset = self._remove_nans_in_data(dataset) 
    274                 if len(dataset.data) > 0: 
    275                     dataset.xmin = np.min(dataset.qx_data) 
    276                     dataset.xmax = np.max(dataset.qx_data) 
    277                     dataset.ymin = np.min(dataset.qy_data) 
    278                     dataset.ymax = np.max(dataset.qx_data) 
     283    @staticmethod 
     284    def set_default_1d_units(data): 
     285        """ 
     286        Set the x and y axes to the default 1D units 
     287        :param data: 1D data set 
     288        :return: 
     289        """ 
     290        data.xaxis("\\rm{Q}", '1/A') 
     291        data.yaxis("\\rm{Intensity}", "1/cm") 
     292        return data 
     293 
     294    @staticmethod 
     295    def set_default_2d_units(data): 
     296        """ 
     297        Set the x and y axes to the default 2D units 
     298        :param data: 2D data set 
     299        :return: 
     300        """ 
     301        data.xaxis("\\rm{Q_{x}}", '1/A') 
     302        data.yaxis("\\rm{Q_{y}}", '1/A') 
     303        data.zaxis("\\rm{Intensity}", "1/cm") 
     304        return data 
     305 
     306    def convert_data_units(self, default_q_unit="1/A", default_i_unit="1/cm"): 
     307        """ 
     308        Converts al; data to the sasview default of units of A^{-1} for Q and 
     309        cm^{-1} for I. 
     310        :param default_x_unit: The default x unit used by Sasview 
     311        :param default_y_unit: The default y unit used by Sasview 
     312        """ 
     313        new_output = [] 
     314        for data in self.output: 
     315            if data.isSesans: 
     316                new_output.append(data) 
     317                continue 
     318            file_x_unit = data._xunit 
     319            data_conv_x = Converter(file_x_unit) 
     320            file_y_unit = data._yunit 
     321            data_conv_y = Converter(file_y_unit) 
     322            if isinstance(data, Data1D): 
     323                try: 
     324                    data.x = data_conv_x(data.x, units=default_q_unit) 
     325                    data._xunit = default_q_unit 
     326                    data.x_unit = default_q_unit 
     327                    if data.dx is not None: 
     328                        data.dx = data_conv_x(data.dx, units=default_q_unit) 
     329                    if data.dxl is not None: 
     330                        data.dxl = data_conv_x(data.dxl, units=default_q_unit) 
     331                    if data.dxw is not None: 
     332                        data.dxw = data_conv_x(data.dxw, units=default_q_unit) 
     333                except KeyError: 
     334                    message = "Unable to convert Q units from {0} to 1/A." 
     335                    message.format(default_q_unit) 
     336                    data.errors.append(message) 
     337                try: 
     338                    data.y = data_conv_y(data.y, units=default_i_unit) 
     339                    data._yunit = default_i_unit 
     340                    data.y_unit = default_i_unit 
     341                    if data.dy is not None: 
     342                        data.dy = data_conv_y(data.dy, units=default_i_unit) 
     343                except KeyError: 
     344                    message = "Unable to convert I units from {0} to 1/cm." 
     345                    message.format(default_q_unit) 
     346                    data.errors.append(message) 
     347            elif isinstance(data, Data2D): 
     348                try: 
     349                    data.qx_data = data_conv_x(data.qx_data, units=default_q_unit) 
     350                    if data.dqx_data is not None: 
     351                        data.dqx_data = data_conv_x(data.dqx_data, units=default_q_unit) 
     352                    data.qy_data = data_conv_y(data.qy_data, units=default_q_unit) 
     353                    if data.dqy_data is not None: 
     354                        data.dqy_data = data_conv_y(data.dqy_data, units=default_q_unit) 
     355                except KeyError: 
     356                    message = "Unable to convert Q units from {0} to 1/A." 
     357                    message.format(default_q_unit) 
     358                    data.errors.append(message) 
     359                try: 
     360                    file_z_unit = data._zunit 
     361                    data_conv_z = Converter(file_z_unit) 
     362                    data.data = data_conv_z(data.data, units=default_i_unit) 
     363                    if data.err_data is not None: 
     364                        data.err_data = data_conv_z(data.err_data, units=default_i_unit) 
     365                except KeyError: 
     366                    message = "Unable to convert I units from {0} to 1/cm." 
     367                    message.format(default_q_unit) 
     368                    data.errors.append(message) 
     369            else: 
     370                # TODO: Throw error of some sort... 
     371                pass 
     372            new_output.append(data) 
     373        self.output = new_output 
    279374 
    280375    def format_unit(self, unit=None): 
  • src/sas/sascalc/dataloader/readers/ascii_reader.py

    r9e6aeaf r3bab401  
    157157 
    158158        self.remove_empty_q_values() 
    159         self.current_dataset.xaxis("\\rm{Q}", 'A^{-1}') 
    160         self.current_dataset.yaxis("\\rm{Intensity}", "cm^{-1}") 
     159        self.current_dataset = self.set_default_1d_units(self.current_dataset) 
    161160 
    162161        # Store loading process information 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r2469df7 r058f6c3  
    812812            node.append(point) 
    813813            self.write_node(point, "Q", datainfo.x[i], 
    814                             {'unit': datainfo.x_unit}) 
     814                            {'unit': datainfo._xunit}) 
    815815            if len(datainfo.y) >= i: 
    816816                self.write_node(point, "I", datainfo.y[i], 
    817                                 {'unit': datainfo.y_unit}) 
     817                                {'unit': datainfo._yunit}) 
    818818            if datainfo.dy is not None and len(datainfo.dy) > i: 
    819819                self.write_node(point, "Idev", datainfo.dy[i], 
    820                                 {'unit': datainfo.y_unit}) 
     820                                {'unit': datainfo._yunit}) 
    821821            if datainfo.dx is not None and len(datainfo.dx) > i: 
    822822                self.write_node(point, "Qdev", datainfo.dx[i], 
    823                                 {'unit': datainfo.x_unit}) 
     823                                {'unit': datainfo._xunit}) 
    824824            if datainfo.dxw is not None and len(datainfo.dxw) > i: 
    825825                self.write_node(point, "dQw", datainfo.dxw[i], 
    826                                 {'unit': datainfo.x_unit}) 
     826                                {'unit': datainfo._xunit}) 
    827827            if datainfo.dxl is not None and len(datainfo.dxl) > i: 
    828828                self.write_node(point, "dQl", datainfo.dxl[i], 
    829                                 {'unit': datainfo.x_unit}) 
     829                                {'unit': datainfo._xunit}) 
    830830        if datainfo.isSesans: 
    831831            sesans_attrib = {'x_axis': datainfo._xaxis, 
  • src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py

    r61f329f0 r96d06a4  
    3838    # CanSAS version 
    3939    cansas_version = 2.0 
    40     # Logged warnings or messages 
    41     logging = None 
    42     # List of errors for the current data set 
    43     errors = None 
    44     # Raw file contents to be processed 
    45     raw_data = None 
    46     # List of plottable1D objects that should be linked to the current_datainfo 
    47     data1d = None 
    48     # List of plottable2D objects that should be linked to the current_datainfo 
    49     data2d = None 
    5040    # Data type name 
    51     type_name = "CanSAS 2.0" 
     41    type_name = "NXcanSAS" 
    5242    # Wildcards 
    53     type = ["CanSAS 2.0 HDF5 Files (*.h5)|*.h5"] 
     43    type = ["NXcanSAS HDF5 Files (*.h5)|*.h5|"] 
    5444    # List of allowed extensions 
    5545    ext = ['.h5', '.H5'] 
     
    8171                except Exception as e: 
    8272                    if extension not in self.ext: 
    83                         msg = "CanSAS2.0 HDF5 Reader could not load file {}".format(basename + extension) 
     73                        msg = "NXcanSAS HDF5 Reader could not load file {}".format(basename + extension) 
    8474                        raise DefaultReaderException(msg) 
    8575                    raise FileContentsException(e.message) 
     
    111101        self.errors = set() 
    112102        self.logging = [] 
     103        self.q_name = [] 
     104        self.mask_name = u'' 
     105        self.i_name = u'' 
     106        self.i_node = u'' 
     107        self.q_uncertainties = [] 
     108        self.q_resolutions = [] 
     109        self.i_uncertainties = u'' 
    113110        self.parent_class = u'' 
    114111        self.detector = Detector() 
     
    140137            if isinstance(value, h5py.Group): 
    141138                # Set parent class before recursion 
     139                last_parent_class = self.parent_class 
    142140                self.parent_class = class_name 
    143141                parent_list.append(key) 
     
    147145                    self.add_data_set(key) 
    148146                elif class_prog.match(u'SASdata'): 
    149                     self._initialize_new_data_set(parent_list) 
     147                    self._initialize_new_data_set(value) 
     148                    self._find_data_attributes(value) 
    150149                # Recursion step to access data within the group 
    151150                self.read_children(value, parent_list) 
     151                self.add_intermediate() 
    152152                # Reset parent class when returning from recursive method 
    153                 self.parent_class = class_name 
    154                 self.add_intermediate() 
     153                self.parent_class = last_parent_class 
    155154                parent_list.remove(key) 
    156155 
     
    159158                data_set = data[key][:] 
    160159                unit = self._get_unit(value) 
    161  
    162                 # I and Q Data 
    163                 if key == u'I': 
    164                     if isinstance(self.current_dataset, plottable_2D): 
    165                         self.current_dataset.data = data_set 
    166                         self.current_dataset.zaxis("Intensity", unit) 
    167                     else: 
    168                         self.current_dataset.y = data_set.flatten() 
    169                         self.current_dataset.yaxis("Intensity", unit) 
    170                     continue 
    171                 elif key == u'Idev': 
    172                     if isinstance(self.current_dataset, plottable_2D): 
    173                         self.current_dataset.err_data = data_set.flatten() 
    174                     else: 
    175                         self.current_dataset.dy = data_set.flatten() 
    176                     continue 
    177                 elif key == u'Q': 
    178                     self.current_dataset.xaxis("Q", unit) 
    179                     if isinstance(self.current_dataset, plottable_2D): 
    180                         self.current_dataset.q = data_set.flatten() 
    181                     else: 
    182                         self.current_dataset.x = data_set.flatten() 
    183                     continue 
    184                 elif key == u'Qdev': 
    185                     self.current_dataset.dx = data_set.flatten() 
    186                     continue 
    187                 elif key == u'dQw': 
    188                     self.current_dataset.dxw = data_set.flatten() 
    189                     continue 
    190                 elif key == u'dQl': 
    191                     self.current_dataset.dxl = data_set.flatten() 
    192                     continue 
    193                 elif key == u'Qy': 
    194                     self.current_dataset.yaxis("Q_y", unit) 
    195                     self.current_dataset.qy_data = data_set.flatten() 
    196                     continue 
    197                 elif key == u'Qydev': 
    198                     self.current_dataset.dqy_data = data_set.flatten() 
    199                     continue 
    200                 elif key == u'Qx': 
    201                     self.current_dataset.xaxis("Q_x", unit) 
    202                     self.current_dataset.qx_data = data_set.flatten() 
    203                     continue 
    204                 elif key == u'Qxdev': 
    205                     self.current_dataset.dqx_data = data_set.flatten() 
    206                     continue 
    207                 elif key == u'Mask': 
    208                     self.current_dataset.mask = data_set.flatten() 
    209                     continue 
    210                 # Transmission Spectrum 
    211                 elif (key == u'T' 
    212                       and self.parent_class == u'SAStransmission_spectrum'): 
    213                     self.trans_spectrum.transmission = data_set.flatten() 
    214                     continue 
    215                 elif (key == u'Tdev' 
    216                       and self.parent_class == u'SAStransmission_spectrum'): 
    217                     self.trans_spectrum.transmission_deviation = \ 
    218                         data_set.flatten() 
    219                     continue 
    220                 elif (key == u'lambda' 
    221                       and self.parent_class == u'SAStransmission_spectrum'): 
    222                     self.trans_spectrum.wavelength = data_set.flatten() 
    223                     continue 
    224160 
    225161                for data_point in data_set: 
     
    232168                    if key == u'definition': 
    233169                        self.current_datainfo.meta_data['reader'] = data_point 
     170                    # Run 
    234171                    elif key == u'run': 
    235172                        self.current_datainfo.run.append(data_point) 
     
    240177                        except Exception: 
    241178                            pass 
     179                    # Title 
    242180                    elif key == u'title': 
    243181                        self.current_datainfo.title = data_point 
     182                    # Note 
    244183                    elif key == u'SASnote': 
    245184                        self.current_datainfo.notes.append(data_point) 
    246  
    247185                    # Sample Information 
    248                     # CanSAS 2.0 format 
    249                     elif key == u'Title' and self.parent_class == u'SASsample': 
    250                         self.current_datainfo.sample.name = data_point 
    251                     # NXcanSAS format 
    252                     elif key == u'name' and self.parent_class == u'SASsample': 
    253                         self.current_datainfo.sample.name = data_point 
    254                     # NXcanSAS format 
    255                     elif key == u'ID' and self.parent_class == u'SASsample': 
    256                         self.current_datainfo.sample.name = data_point 
    257                     elif (key == u'thickness' 
    258                           and self.parent_class == u'SASsample'): 
    259                         self.current_datainfo.sample.thickness = data_point 
    260                     elif (key == u'temperature' 
    261                           and self.parent_class == u'SASsample'): 
    262                         self.current_datainfo.sample.temperature = data_point 
    263                     elif (key == u'transmission' 
    264                           and self.parent_class == u'SASsample'): 
    265                         self.current_datainfo.sample.transmission = data_point 
    266                     elif (key == u'x_position' 
    267                           and self.parent_class == u'SASsample'): 
    268                         self.current_datainfo.sample.position.x = data_point 
    269                     elif (key == u'y_position' 
    270                           and self.parent_class == u'SASsample'): 
    271                         self.current_datainfo.sample.position.y = data_point 
    272                     elif key == u'pitch' and self.parent_class == u'SASsample': 
    273                         self.current_datainfo.sample.orientation.x = data_point 
    274                     elif key == u'yaw' and self.parent_class == u'SASsample': 
    275                         self.current_datainfo.sample.orientation.y = data_point 
    276                     elif key == u'roll' and self.parent_class == u'SASsample': 
    277                         self.current_datainfo.sample.orientation.z = data_point 
    278                     elif (key == u'details' 
    279                           and self.parent_class == u'SASsample'): 
    280                         self.current_datainfo.sample.details.append(data_point) 
    281  
     186                    elif self.parent_class == u'SASsample': 
     187                        self.process_sample(data_point, key) 
    282188                    # Instrumental Information 
    283189                    elif (key == u'name' 
    284190                          and self.parent_class == u'SASinstrument'): 
    285191                        self.current_datainfo.instrument = data_point 
    286                     elif key == u'name' and self.parent_class == u'SASdetector': 
    287                         self.detector.name = data_point 
    288                     elif key == u'SDD' and self.parent_class == u'SASdetector': 
    289                         self.detector.distance = float(data_point) 
    290                         self.detector.distance_unit = unit 
    291                     elif (key == u'slit_length' 
    292                           and self.parent_class == u'SASdetector'): 
    293                         self.detector.slit_length = float(data_point) 
    294                         self.detector.slit_length_unit = unit 
    295                     elif (key == u'x_position' 
    296                           and self.parent_class == u'SASdetector'): 
    297                         self.detector.offset.x = float(data_point) 
    298                         self.detector.offset_unit = unit 
    299                     elif (key == u'y_position' 
    300                           and self.parent_class == u'SASdetector'): 
    301                         self.detector.offset.y = float(data_point) 
    302                         self.detector.offset_unit = unit 
    303                     elif (key == u'pitch' 
    304                           and self.parent_class == u'SASdetector'): 
    305                         self.detector.orientation.x = float(data_point) 
    306                         self.detector.orientation_unit = unit 
    307                     elif key == u'roll' and self.parent_class == u'SASdetector': 
    308                         self.detector.orientation.z = float(data_point) 
    309                         self.detector.orientation_unit = unit 
    310                     elif key == u'yaw' and self.parent_class == u'SASdetector': 
    311                         self.detector.orientation.y = float(data_point) 
    312                         self.detector.orientation_unit = unit 
    313                     elif (key == u'beam_center_x' 
    314                           and self.parent_class == u'SASdetector'): 
    315                         self.detector.beam_center.x = float(data_point) 
    316                         self.detector.beam_center_unit = unit 
    317                     elif (key == u'beam_center_y' 
    318                           and self.parent_class == u'SASdetector'): 
    319                         self.detector.beam_center.y = float(data_point) 
    320                         self.detector.beam_center_unit = unit 
    321                     elif (key == u'x_pixel_size' 
    322                           and self.parent_class == u'SASdetector'): 
    323                         self.detector.pixel_size.x = float(data_point) 
    324                         self.detector.pixel_size_unit = unit 
    325                     elif (key == u'y_pixel_size' 
    326                           and self.parent_class == u'SASdetector'): 
    327                         self.detector.pixel_size.y = float(data_point) 
    328                         self.detector.pixel_size_unit = unit 
    329                     elif (key == u'distance' 
    330                           and self.parent_class == u'SAScollimation'): 
    331                         self.collimation.length = data_point 
    332                         self.collimation.length_unit = unit 
    333                     elif (key == u'name' 
    334                           and self.parent_class == u'SAScollimation'): 
    335                         self.collimation.name = data_point 
    336                     elif (key == u'shape' 
    337                           and self.parent_class == u'SASaperture'): 
    338                         self.aperture.shape = data_point 
    339                     elif (key == u'x_gap' 
    340                           and self.parent_class == u'SASaperture'): 
    341                         self.aperture.size.x = data_point 
    342                     elif (key == u'y_gap' 
    343                           and self.parent_class == u'SASaperture'): 
    344                         self.aperture.size.y = data_point 
    345  
     192                    # Detector 
     193                    elif self.parent_class == u'SASdetector': 
     194                        self.process_detector(data_point, key, unit) 
     195                    # Collimation 
     196                    elif self.parent_class == u'SAScollimation': 
     197                        self.process_collimation(data_point, key, unit) 
     198                    # Aperture 
     199                    elif self.parent_class == u'SASaperture': 
     200                        self.process_aperture(data_point, key) 
    346201                    # Process Information 
    347                     elif (key == u'Title' 
    348                           and self.parent_class == u'SASprocess'): # CanSAS 2.0 
    349                         self.process.name = data_point 
    350                     elif (key == u'name' 
    351                           and self.parent_class == u'SASprocess'): # NXcanSAS 
    352                         self.process.name = data_point 
    353                     elif (key == u'description' 
    354                           and self.parent_class == u'SASprocess'): 
    355                         self.process.description = data_point 
    356                     elif key == u'date' and self.parent_class == u'SASprocess': 
    357                         self.process.date = data_point 
    358                     elif key == u'term' and self.parent_class == u'SASprocess': 
    359                         self.process.term = data_point 
    360                     elif self.parent_class == u'SASprocess': 
    361                         self.process.notes.append(data_point) 
    362  
     202                    elif self.parent_class == u'SASprocess': # CanSAS 2.0 
     203                        self.process_process(data_point, key) 
    363204                    # Source 
    364                     elif (key == u'wavelength' 
    365                           and self.parent_class == u'SASdata'): 
    366                         self.current_datainfo.source.wavelength = data_point 
    367                         self.current_datainfo.source.wavelength_unit = unit 
    368                     elif (key == u'incident_wavelength' 
    369                           and self.parent_class == 'SASsource'): 
    370                         self.current_datainfo.source.wavelength = data_point 
    371                         self.current_datainfo.source.wavelength_unit = unit 
    372                     elif (key == u'wavelength_max' 
    373                           and self.parent_class == u'SASsource'): 
    374                         self.current_datainfo.source.wavelength_max = data_point 
    375                         self.current_datainfo.source.wavelength_max_unit = unit 
    376                     elif (key == u'wavelength_min' 
    377                           and self.parent_class == u'SASsource'): 
    378                         self.current_datainfo.source.wavelength_min = data_point 
    379                         self.current_datainfo.source.wavelength_min_unit = unit 
    380                     elif (key == u'incident_wavelength_spread' 
    381                           and self.parent_class == u'SASsource'): 
    382                         self.current_datainfo.source.wavelength_spread = \ 
    383                             data_point 
    384                         self.current_datainfo.source.wavelength_spread_unit = \ 
    385                             unit 
    386                     elif (key == u'beam_size_x' 
    387                           and self.parent_class == u'SASsource'): 
    388                         self.current_datainfo.source.beam_size.x = data_point 
    389                         self.current_datainfo.source.beam_size_unit = unit 
    390                     elif (key == u'beam_size_y' 
    391                           and self.parent_class == u'SASsource'): 
    392                         self.current_datainfo.source.beam_size.y = data_point 
    393                         self.current_datainfo.source.beam_size_unit = unit 
    394                     elif (key == u'beam_shape' 
    395                           and self.parent_class == u'SASsource'): 
    396                         self.current_datainfo.source.beam_shape = data_point 
    397                     elif (key == u'radiation' 
    398                           and self.parent_class == u'SASsource'): 
    399                         self.current_datainfo.source.radiation = data_point 
    400                     elif (key == u'transmission' 
    401                           and self.parent_class == u'SASdata'): 
    402                         self.current_datainfo.sample.transmission = data_point 
    403  
     205                    elif self.parent_class == u'SASsource': 
     206                        self.process_source(data_point, key, unit) 
    404207                    # Everything else goes in meta_data 
     208                    elif self.parent_class == u'SASdata': 
     209                        if isinstance(self.current_dataset, plottable_2D): 
     210                            self.process_2d_data_object(data_set, key, unit) 
     211                        else: 
     212                            self.process_1d_data_object(data_set, key, unit) 
     213 
     214                        break 
     215                    elif self.parent_class == u'SAStransmission_spectrum': 
     216                        self.process_trans_spectrum(data_set, key) 
     217                        break 
    405218                    else: 
    406219                        new_key = self._create_unique_key( 
     
    411224                # I don't know if this reachable code 
    412225                self.errors.add("ShouldNeverHappenException") 
     226 
     227    def process_1d_data_object(self, data_set, key, unit): 
     228        """ 
     229        SASdata processor method for 1d data items 
     230        :param data_set: data from HDF5 file 
     231        :param key: canSAS_class attribute 
     232        :param unit: unit attribute 
     233        """ 
     234        if key == self.i_name: 
     235            self.current_dataset.y = data_set.flatten() 
     236            self.current_dataset.yaxis("Intensity", unit) 
     237        elif key == self.i_uncertainties: 
     238            self.current_dataset.dy = data_set.flatten() 
     239        elif key in self.q_name: 
     240            self.current_dataset.xaxis("Q", unit) 
     241            self.current_dataset.x = data_set.flatten() 
     242        elif key in self.q_uncertainties or key in self.q_resolutions: 
     243            if (len(self.q_resolutions) > 1 
     244                    and np.where(self.q_resolutions == key)[0] == 0): 
     245                self.current_dataset.dxw = data_set.flatten() 
     246            elif (len(self.q_resolutions) > 1 
     247                  and np.where(self.q_resolutions == key)[0] == 1): 
     248                self.current_dataset.dxl = data_set.flatten() 
     249            else: 
     250                self.current_dataset.dx = data_set.flatten() 
     251        elif key == self.mask_name: 
     252            self.current_dataset.mask = data_set.flatten() 
     253        elif key == u'wavelength': 
     254            self.current_datainfo.source.wavelength = data_set[0] 
     255            self.current_datainfo.source.wavelength_unit = unit 
     256 
     257    def process_2d_data_object(self, data_set, key, unit): 
     258        if key == self.i_name: 
     259            self.current_dataset.data = data_set 
     260            self.current_dataset.zaxis("Intensity", unit) 
     261        elif key == self.i_uncertainties: 
     262            self.current_dataset.err_data = data_set.flatten() 
     263        elif key in self.q_name: 
     264            self.current_dataset.xaxis("Q", unit) 
     265            self.current_dataset.yaxis("Q", unit) 
     266            #FIXME: This is broken - need to properly handle 2D data 
     267            # TODO: Check shape of array (2d - cash money, homey!) 
     268            # TODO: 3D - check dims, etc. 
     269            # TODO: Put data where it belongs 
     270            pass 
     271        elif key in self.q_uncertainties or key in self.q_resolutions: 
     272            # FIXME: This isn't right either. 
     273            # TODO: find resolution/uncertainty specific to q_name 
     274            pass 
     275        elif key == u'Qy': 
     276            self.current_dataset.yaxis("Q_y", unit) 
     277            self.current_dataset.qy_data = data_set.flatten() 
     278        elif key == u'Qydev': 
     279            self.current_dataset.dqy_data = data_set.flatten() 
     280        elif key == u'Qx': 
     281            self.current_dataset.xaxis("Q_x", unit) 
     282            self.current_dataset.qx_data = data_set.flatten() 
     283        elif key == u'Qxdev': 
     284            self.current_dataset.dqx_data = data_set.flatten() 
     285 
     286    def process_trans_spectrum(self, data_set, key): 
     287        """ 
     288        SAStransmission_spectrum processor 
     289        :param data_set: data from HDF5 file 
     290        :param key: canSAS_class attribute 
     291        """ 
     292        if key == u'T': 
     293            self.trans_spectrum.transmission = data_set.flatten() 
     294        elif key == u'Tdev': 
     295            self.trans_spectrum.transmission_deviation = data_set.flatten() 
     296        elif key == u'lambda': 
     297            self.trans_spectrum.wavelength = data_set.flatten() 
     298 
     299    def process_sample(self, data_point, key): 
     300        """ 
     301        SASsample processor 
     302        :param data_point: Single point from an HDF5 data file 
     303        :param key: class name data_point was taken from 
     304        """ 
     305        if key == u'Title': 
     306            self.current_datainfo.sample.name = data_point 
     307        elif key == u'name': 
     308            self.current_datainfo.sample.name = data_point 
     309        elif key == u'ID': 
     310            self.current_datainfo.sample.name = data_point 
     311        elif key == u'thickness': 
     312            self.current_datainfo.sample.thickness = data_point 
     313        elif key == u'temperature': 
     314            self.current_datainfo.sample.temperature = data_point 
     315        elif key == u'transmission': 
     316            self.current_datainfo.sample.transmission = data_point 
     317        elif key == u'x_position': 
     318            self.current_datainfo.sample.position.x = data_point 
     319        elif key == u'y_position': 
     320            self.current_datainfo.sample.position.y = data_point 
     321        elif key == u'pitch': 
     322            self.current_datainfo.sample.orientation.x = data_point 
     323        elif key == u'yaw': 
     324            self.current_datainfo.sample.orientation.y = data_point 
     325        elif key == u'roll': 
     326            self.current_datainfo.sample.orientation.z = data_point 
     327        elif key == u'details': 
     328            self.current_datainfo.sample.details.append(data_point) 
     329 
     330    def process_detector(self, data_point, key, unit): 
     331        """ 
     332        SASdetector processor 
     333        :param data_point: Single point from an HDF5 data file 
     334        :param key: class name data_point was taken from 
     335        :param unit: unit attribute from data set 
     336        """ 
     337        if key == u'name': 
     338            self.detector.name = data_point 
     339        elif key == u'SDD': 
     340            self.detector.distance = float(data_point) 
     341            self.detector.distance_unit = unit 
     342        elif key == u'slit_length': 
     343            self.detector.slit_length = float(data_point) 
     344            self.detector.slit_length_unit = unit 
     345        elif key == u'x_position': 
     346            self.detector.offset.x = float(data_point) 
     347            self.detector.offset_unit = unit 
     348        elif key == u'y_position': 
     349            self.detector.offset.y = float(data_point) 
     350            self.detector.offset_unit = unit 
     351        elif key == u'pitch': 
     352            self.detector.orientation.x = float(data_point) 
     353            self.detector.orientation_unit = unit 
     354        elif key == u'roll': 
     355            self.detector.orientation.z = float(data_point) 
     356            self.detector.orientation_unit = unit 
     357        elif key == u'yaw': 
     358            self.detector.orientation.y = float(data_point) 
     359            self.detector.orientation_unit = unit 
     360        elif key == u'beam_center_x': 
     361            self.detector.beam_center.x = float(data_point) 
     362            self.detector.beam_center_unit = unit 
     363        elif key == u'beam_center_y': 
     364            self.detector.beam_center.y = float(data_point) 
     365            self.detector.beam_center_unit = unit 
     366        elif key == u'x_pixel_size': 
     367            self.detector.pixel_size.x = float(data_point) 
     368            self.detector.pixel_size_unit = unit 
     369        elif key == u'y_pixel_size': 
     370            self.detector.pixel_size.y = float(data_point) 
     371            self.detector.pixel_size_unit = unit 
     372 
     373    def process_collimation(self, data_point, key, unit): 
     374        """ 
     375        SAScollimation processor 
     376        :param data_point: Single point from an HDF5 data file 
     377        :param key: class name data_point was taken from 
     378        :param unit: unit attribute from data set 
     379        """ 
     380        if key == u'distance': 
     381            self.collimation.length = data_point 
     382            self.collimation.length_unit = unit 
     383        elif key == u'name': 
     384            self.collimation.name = data_point 
     385 
     386    def process_aperture(self, data_point, key): 
     387        """ 
     388        SASaperture processor 
     389        :param data_point: Single point from an HDF5 data file 
     390        :param key: class name data_point was taken from 
     391        """ 
     392        if key == u'shape': 
     393            self.aperture.shape = data_point 
     394        elif key == u'x_gap': 
     395            self.aperture.size.x = data_point 
     396        elif key == u'y_gap': 
     397            self.aperture.size.y = data_point 
     398 
     399    def process_source(self, data_point, key, unit): 
     400        """ 
     401        SASsource processor 
     402        :param data_point: Single point from an HDF5 data file 
     403        :param key: class name data_point was taken from 
     404        :param unit: unit attribute from data set 
     405        """ 
     406        if key == u'incident_wavelength': 
     407            self.current_datainfo.source.wavelength = data_point 
     408            self.current_datainfo.source.wavelength_unit = unit 
     409        elif key == u'wavelength_max': 
     410            self.current_datainfo.source.wavelength_max = data_point 
     411            self.current_datainfo.source.wavelength_max_unit = unit 
     412        elif key == u'wavelength_min': 
     413            self.current_datainfo.source.wavelength_min = data_point 
     414            self.current_datainfo.source.wavelength_min_unit = unit 
     415        elif key == u'incident_wavelength_spread': 
     416            self.current_datainfo.source.wavelength_spread = data_point 
     417            self.current_datainfo.source.wavelength_spread_unit = unit 
     418        elif key == u'beam_size_x': 
     419            self.current_datainfo.source.beam_size.x = data_point 
     420            self.current_datainfo.source.beam_size_unit = unit 
     421        elif key == u'beam_size_y': 
     422            self.current_datainfo.source.beam_size.y = data_point 
     423            self.current_datainfo.source.beam_size_unit = unit 
     424        elif key == u'beam_shape': 
     425            self.current_datainfo.source.beam_shape = data_point 
     426        elif key == u'radiation': 
     427            self.current_datainfo.source.radiation = data_point 
     428 
     429    def process_process(self, data_point, key): 
     430        """ 
     431        SASprocess processor 
     432        :param data_point: Single point from an HDF5 data file 
     433        :param key: class name data_point was taken from 
     434        """ 
     435        term_match = re.compile(u'^term[0-9]+$') 
     436        if key == u'Title':  # CanSAS 2.0 
     437            self.process.name = data_point 
     438        elif key == u'name':  # NXcanSAS 
     439            self.process.name = data_point 
     440        elif key == u'description': 
     441            self.process.description = data_point 
     442        elif key == u'date': 
     443            self.process.date = data_point 
     444        elif term_match.match(key): 
     445            self.process.term.append(data_point) 
     446        else: 
     447            self.process.notes.append(data_point) 
    413448 
    414449    def add_intermediate(self): 
     
    452487            spectrum_list = [] 
    453488            for spectrum in self.current_datainfo.trans_spectrum: 
    454                 spectrum.transmission = np.delete(spectrum.transmission, [0]) 
    455489                spectrum.transmission = spectrum.transmission.astype(np.float64) 
    456                 spectrum.transmission_deviation = np.delete( 
    457                     spectrum.transmission_deviation, [0]) 
    458490                spectrum.transmission_deviation = \ 
    459491                    spectrum.transmission_deviation.astype(np.float64) 
    460                 spectrum.wavelength = np.delete(spectrum.wavelength, [0]) 
    461492                spectrum.wavelength = spectrum.wavelength.astype(np.float64) 
    462493                if len(spectrum.transmission) > 0: 
     
    491522                (n_rows, n_cols) = dataset.data.shape 
    492523                dataset.y_bins = dataset.qy_data[0::n_cols] 
    493                 dataset.x_bins = dataset.qx_data[:n_cols] 
     524                dataset.x_bins = dataset.qx_data[0::n_rows] 
    494525                dataset.data = dataset.data.flatten() 
    495526            self.current_dataset = dataset 
     
    515546        self.current_datainfo = DataInfo() 
    516547 
    517  
    518     def _initialize_new_data_set(self, parent_list=None): 
     548    def _initialize_new_data_set(self, value=None): 
    519549        """ 
    520550        A private class method to generate a new 1D or 2D data object based on 
     
    524554        :param parent_list: List of names of parent elements 
    525555        """ 
    526  
    527         if parent_list is None: 
    528             parent_list = [] 
    529         if self._find_intermediate(parent_list, "Qx"): 
     556        if self._is2d(value): 
    530557            self.current_dataset = plottable_2D() 
    531558        else: 
     
    534561            self.current_dataset = plottable_1D(x, y) 
    535562        self.current_datainfo.filename = self.raw_data.filename 
    536  
    537     def _find_intermediate(self, parent_list, basename=""): 
    538         """ 
    539         A private class used to find an entry by either using a direct key or 
    540         knowing the approximate basename. 
     563        self.mask_name = "" 
     564        self.i_name = "" 
     565        self.i_node = "" 
     566        self.q_name = [] 
     567        self.q_uncertainties = [] 
     568        self.q_resolutions = [] 
     569        self.i_uncertainties = "" 
     570 
     571    @staticmethod 
     572    def check_is_list_or_array(iterable): 
     573        try: 
     574            iter(iterable) 
     575            if (not isinstance(iterable, np.ndarray)) or (isinstance(iterable, str) 
     576                    or isinstance(iterable, unicode)): 
     577                raise TypeError 
     578        except TypeError: 
     579            iterable = iterable.split(",") 
     580        return iterable 
     581 
     582    def _find_data_attributes(self, value): 
     583        """ 
     584        A class to find the indices for Q, the name of the Qdev and Idev, and 
     585        the name of the mask. 
     586        :param value: SASdata/NXdata HDF5 Group 
     587        """ 
     588        attrs = value.attrs 
     589        signal = attrs.get("signal", "I") 
     590        i_axes = attrs.get("I_axes", ["Q"]) 
     591        q_indices = attrs.get("Q_indices", [0]) 
     592        q_indices = map(int, self.check_is_list_or_array(q_indices)) 
     593        i_axes = self.check_is_list_or_array(i_axes) 
     594        keys = value.keys() 
     595        self.mask_name = attrs.get("mask") 
     596        for val in q_indices: 
     597            self.q_name.append(i_axes[val]) 
     598        self.i_name = signal 
     599        self.i_node = value.get(self.i_name) 
     600        for item in self.q_name: 
     601            if item in keys: 
     602                q_vals = value.get(item) 
     603                if q_vals.attrs.get("uncertainties") is not None: 
     604                    self.q_uncertainties = q_vals.attrs.get("uncertainties") 
     605                elif q_vals.attrs.get("uncertainty") is not None: 
     606                    self.q_uncertainties = q_vals.attrs.get("uncertainty") 
     607                if isinstance(self.q_uncertainties, str) is not None: 
     608                    self.q_uncertainties = [self.q_uncertainties] 
     609                if q_vals.attrs.get("resolutions") is not None: 
     610                    self.q_resolutions = q_vals.attrs.get("resolutions") 
     611                if isinstance(self.q_resolutions, str): 
     612                    self.q_resolutions = self.q_resolutions.split(",") 
     613        if self.i_name in keys: 
     614            i_vals = value.get(self.i_name) 
     615            self.i_uncertainties = i_vals.attrs.get("uncertainties") 
     616            if self.i_uncertainties is None: 
     617                self.i_uncertainties = i_vals.attrs.get("uncertainty") 
     618 
     619    def _is2d(self, value, basename="I"): 
     620        """ 
     621        A private class to determine if the data set is 1d or 2d. 
    541622 
    542623        :param parent_list: List of parents nodes in the HDF5 file 
    543624        :param basename: Approximate name of an entry to search for 
    544         :return: 
    545         """ 
    546  
    547         entry = False 
    548         key_prog = re.compile(basename) 
    549         top = self.raw_data 
    550         for parent in parent_list: 
    551             top = top.get(parent) 
    552         for key in top.keys(): 
    553             if key_prog.match(key): 
    554                 entry = True 
    555                 break 
    556         return entry 
     625        :return: True if 2D, otherwise false 
     626        """ 
     627 
     628        vals = value.get(basename) 
     629        return (vals is not None and vals.shape is not None 
     630                and len(vals.shape) != 1) 
    557631 
    558632    def _create_unique_key(self, dictionary, name, numb=0): 
     
    583657        if unit is None: 
    584658            unit = h5attr(value, u'unit') 
    585         # Convert the unit formats 
    586         if unit == "1/A": 
    587             unit = "A^{-1}" 
    588         elif unit == "1/cm": 
    589             unit = "cm^{-1}" 
    590659        return unit 
  • src/sas/sascalc/dataloader/readers/danse_reader.py

    r2469df7 rfc51d06  
    180180        detector.beam_center.y = center_y * pixel 
    181181 
    182  
    183         self.current_dataset.xaxis("\\rm{Q_{x}}", 'A^{-1}') 
    184         self.current_dataset.yaxis("\\rm{Q_{y}}", 'A^{-1}') 
    185         self.current_dataset.zaxis("\\rm{Intensity}", "cm^{-1}") 
    186  
     182        self.current_dataset = self.set_default_2d_units(self.current_dataset) 
    187183        self.current_dataset.x_bins = x_vals 
    188184        self.current_dataset.y_bins = y_vals 
  • src/sas/sascalc/dataloader/readers/red2d_reader.py

    rc8321cfc r058f6c3  
    317317 
    318318        # Units of axes 
    319         self.current_dataset.xaxis(r"\rm{Q_{x}}", 'A^{-1}') 
    320         self.current_dataset.yaxis(r"\rm{Q_{y}}", 'A^{-1}') 
    321         self.current_dataset.zaxis(r"\rm{Intensity}", "cm^{-1}") 
     319        self.current_dataset = self.set_default_2d_units(self.current_dataset) 
    322320 
    323321        # Store loading process information 
  • src/sas/sascalc/file_converter/nxcansas_writer.py

    r574adc7 rcf29187  
    175175            names=['beam_size_x', 'beam_size_y'], 
    176176            units=data_info.source.beam_size_unit, write_fn=_write_h5_float) 
    177  
    178177 
    179178        # Collimation metadata 
     
    232231            detector_entry.attrs['name'] = '' 
    233232 
     233        # Process meta data 
     234        if len(data_info.process) > 0 and not data_info.process[0].is_empty(): 
     235            i = 1 
     236            for process in data_info.process: 
     237                process_entry = sasentry.create_group( 
     238                    'sasprocess{0:0=2d}'.format(i)) 
     239                process_entry.attrs['canSAS_class'] = 'SASprocess' 
     240                if process.name: 
     241                    name = _h5_string(process.name) 
     242                    process_entry.create_dataset('name', data=name) 
     243                if process.date: 
     244                    date = _h5_string(process.date) 
     245                    process_entry.create_dataset('date', data=date) 
     246                if process.description: 
     247                    desc = _h5_string(process.description) 
     248                    process_entry.create_dataset('description', data=desc) 
     249                j = 1 
     250                for term in process.term: 
     251                    if term: 
     252                        h5_term = _h5_string(term) 
     253                        process_entry.create_dataset('term{0:0=2d}'.format(j), 
     254                                                     data=h5_term) 
     255                    j += 1 
     256                j = 1 
     257                for note in process.notes: 
     258                    if note: 
     259                        h5_note = _h5_string(note) 
     260                        process_entry.create_dataset('note{0:0=2d}'.format(j), 
     261                                                     data=h5_note) 
     262                    j += 1 
     263                i += 1 
     264 
     265        # Transmission Spectrum 
     266        if len(data_info.trans_spectrum) > 0: 
     267            i = 1 
     268            for trans in data_info.trans_spectrum: 
     269                trans_entry = sasentry.create_group( 
     270                    'sastransmission_spectrum{0:0=2d}'.format(i)) 
     271                trans_entry.attrs['canSAS_class'] = 'SAStransmission_spectrum' 
     272                trans_entry.attrs['signal'] = 'T' 
     273                trans_entry.attrs['T_axes'] = 'T' 
     274                trans_entry.attrs['name'] = trans.name 
     275                if trans.timestamp is not '': 
     276                    trans_entry.attrs['timestamp'] = trans.timestamp 
     277                transmission = trans_entry.create_dataset( 
     278                    'T', data=trans.transmission) 
     279                transmission.attrs['unertainties'] = 'Tdev' 
     280                trans_entry.create_dataset('Tdev', 
     281                                           data = trans.transmission_deviation) 
     282                trans_entry.create_dataset('lambda', data=trans.wavelength) 
     283 
    234284        note_entry = sasentry.create_group('sasnote'.format(i)) 
    235285        note_entry.attrs['canSAS_class'] = 'SASnote' 
     
    254304        data_entry.attrs['signal'] = 'I' 
    255305        data_entry.attrs['I_axes'] = 'Q' 
    256         data_entry.attrs['I_uncertainties'] = 'Idev' 
    257         data_entry.attrs['Q_indicies'] = 0 
    258  
    259         dI = data_obj.dy 
    260         if dI is None: 
    261             dI = np.zeros((data_obj.y.shape)) 
    262  
    263         data_entry.create_dataset('Q', data=data_obj.x) 
    264         data_entry.create_dataset('I', data=data_obj.y) 
    265         data_entry.create_dataset('Idev', data=dI) 
     306        data_entry.attrs['Q_indices'] = [0] 
     307        q_entry = data_entry.create_dataset('Q', data=data_obj.x) 
     308        q_entry.attrs['units'] = data_obj.x_unit 
     309        i_entry = data_entry.create_dataset('I', data=data_obj.y) 
     310        i_entry.attrs['units'] = data_obj.y_unit 
     311        if data_obj.dy is not None: 
     312            i_entry.attrs['uncertainties'] = 'Idev' 
     313            i_dev_entry = data_entry.create_dataset('Idev', data=data_obj.dy) 
     314            i_dev_entry.attrs['units'] = data_obj.y_unit 
     315        if data_obj.dx is not None: 
     316            q_entry.attrs['resolutions'] = 'dQ' 
     317            dq_entry = data_entry.create_dataset('dQ', data=data_obj.dx) 
     318            dq_entry.attrs['units'] = data_obj.x_unit 
     319        elif data_obj.dxl is not None: 
     320            q_entry.attrs['resolutions'] = ['dQl','dQw'] 
     321            dql_entry = data_entry.create_dataset('dQl', data=data_obj.dxl) 
     322            dql_entry.attrs['units'] = data_obj.x_unit 
     323            dqw_entry = data_entry.create_dataset('dQw', data=data_obj.dxw) 
     324            dqw_entry.attrs['units'] = data_obj.x_unit 
    266325 
    267326    def _write_2d_data(self, data, data_entry): 
     
    273332        """ 
    274333        data_entry.attrs['signal'] = 'I' 
    275         data_entry.attrs['I_axes'] = 'Q,Q' 
    276         data_entry.attrs['I_uncertainties'] = 'Idev' 
    277         data_entry.attrs['Q_indicies'] = [0,1] 
     334        data_entry.attrs['I_axes'] = 'Qx,Qy' 
     335        data_entry.attrs['Q_indices'] = [0,1] 
    278336 
    279337        (n_rows, n_cols) = (len(data.y_bins), len(data.x_bins)) 
     
    288346                raise ValueError("Unable to calculate dimensions of 2D data") 
    289347 
    290         I = np.reshape(data.data, (n_rows, n_cols)) 
    291         dI = np.zeros((n_rows, n_cols)) 
    292         if not all(data.err_data == [None]): 
    293             dI = np.reshape(data.err_data, (n_rows, n_cols)) 
    294         qx =  np.reshape(data.qx_data, (n_rows, n_cols)) 
     348        intensity = np.reshape(data.data, (n_rows, n_cols)) 
     349        qx = np.reshape(data.qx_data, (n_rows, n_cols)) 
    295350        qy = np.reshape(data.qy_data, (n_rows, n_cols)) 
    296351 
    297         I_entry = data_entry.create_dataset('I', data=I) 
    298         I_entry.attrs['units'] = data.I_unit 
    299         Qx_entry = data_entry.create_dataset('Qx', data=qx) 
    300         Qx_entry.attrs['units'] = data.Q_unit 
    301         Qy_entry = data_entry.create_dataset('Qy', data=qy) 
    302         Qy_entry.attrs['units'] = data.Q_unit 
    303         Idev_entry = data_entry.create_dataset('Idev', data=dI) 
    304         Idev_entry.attrs['units'] = data.I_unit 
     352        i_entry = data_entry.create_dataset('I', data=intensity) 
     353        i_entry.attrs['units'] = data.I_unit 
     354        qx_entry = data_entry.create_dataset('Qx', data=qx) 
     355        qx_entry.attrs['units'] = data.Q_unit 
     356        qy_entry = data_entry.create_dataset('Qy', data=qy) 
     357        qy_entry.attrs['units'] = data.Q_unit 
     358        if data.err_data is not None and not all(data.err_data == [None]): 
     359            d_i = np.reshape(data.err_data, (n_rows, n_cols)) 
     360            i_entry.attrs['uncertainties'] = 'Idev' 
     361            i_dev_entry = data_entry.create_dataset('Idev', data=d_i) 
     362            i_dev_entry.attrs['units'] = data.I_unit 
     363        if data.dqx_data is not None and not all(data.dqx_data == [None]): 
     364            qx_entry.attrs['resolutions'] = 'dQx' 
     365            dqx_entry = data_entry.create_dataset('dQx', data=data.dqx_data) 
     366            dqx_entry.attrs['units'] = data.Q_unit 
     367        if data.dqy_data is not None and not all(data.dqy_data == [None]): 
     368            qy_entry.attrs['resolutions'] = 'dQy' 
     369            dqy_entry = data_entry.create_dataset('dQy', data=data.dqy_data) 
     370            dqy_entry.attrs['units'] = data.Q_unit 
  • src/sas/sasgui/guiframe/gui_manager.py

    rb963b20 rb799f09  
    4646from sas.sasgui.guiframe.CategoryManager import CategoryManager 
    4747from sas.sascalc.dataloader.loader import Loader 
     48from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter 
    4849from sas.sasgui.guiframe.proxy import Connection 
    4950 
     
    24222423        default_name = fname 
    24232424        wildcard = "Text files (*.txt)|*.txt|"\ 
    2424                     "CanSAS 1D files(*.xml)|*.xml" 
    2425         path = None 
     2425                    "CanSAS 1D files (*.xml)|*.xml|"\ 
     2426                     "NXcanSAS files (*.h5)|*.h5|" 
     2427        options = {0: ".txt", 
     2428                   1: ".xml", 
     2429                   2: ".h5"} 
    24262430        dlg = wx.FileDialog(self, "Choose a file", 
    24272431                            self._default_save_location, 
     
    24332437            # This is MAC Fix 
    24342438            ext_num = dlg.GetFilterIndex() 
    2435             if ext_num == 0: 
    2436                 ext_format = '.txt' 
    2437             else: 
    2438                 ext_format = '.xml' 
     2439 
     2440            ext_format = options[ext_num] 
    24392441            path = os.path.splitext(path)[0] + ext_format 
    24402442            mypath = os.path.basename(path) 
    2441  
    2442             # Instantiate a loader 
    2443             loader = Loader() 
    2444             ext_format = ".txt" 
    2445             if os.path.splitext(mypath)[1].lower() == ext_format: 
     2443            fName = os.path.splitext(path)[0] + ext_format 
     2444 
     2445            if os.path.splitext(mypath)[1].lower() == options[0]: 
    24462446                # Make sure the ext included in the file name 
    24472447                # especially on MAC 
    2448                 fName = os.path.splitext(path)[0] + ext_format 
    24492448                self._onsaveTXT(data, fName) 
    2450             ext_format = ".xml" 
    2451             if os.path.splitext(mypath)[1].lower() == ext_format: 
     2449            elif os.path.splitext(mypath)[1].lower() == options[1]: 
    24522450                # Make sure the ext included in the file name 
    24532451                # especially on MAC 
    2454                 fName = os.path.splitext(path)[0] + ext_format 
     2452                # Instantiate a loader 
     2453                loader = Loader() 
    24552454                loader.save(fName, data, ext_format) 
     2455            elif os.path.splitext(mypath)[1].lower() == options[2]: 
     2456                nxcansaswriter = NXcanSASWriter() 
     2457                nxcansaswriter.write([data], fName) 
    24562458            try: 
    24572459                self._default_save_location = os.path.dirname(path) 
     
    25652567        """ 
    25662568        default_name = fname 
    2567         wildcard = "IGOR/DAT 2D file in Q_map (*.dat)|*.DAT" 
     2569        wildcard = "IGOR/DAT 2D file in Q_map (*.dat)|*.DAT|"\ 
     2570                   "NXcanSAS files (*.h5)|*.h5|" 
    25682571        dlg = wx.FileDialog(self, "Choose a file", 
    25692572                            self._default_save_location, 
     
    25772580            if ext_num == 0: 
    25782581                ext_format = '.dat' 
     2582            elif ext_num == 1: 
     2583                ext_format = '.h5' 
    25792584            else: 
    25802585                ext_format = '' 
     
    25842589            # Instantiate a loader 
    25852590            loader = Loader() 
    2586  
    2587             ext_format = ".dat" 
    2588             if os.path.splitext(mypath)[1].lower() == ext_format: 
     2591            if os.path.splitext(mypath)[1].lower() == '.dat': 
    25892592                # Make sure the ext included in the file name 
    25902593                # especially on MAC 
    25912594                fileName = os.path.splitext(path)[0] + ext_format 
    25922595                loader.save(fileName, data, ext_format) 
     2596            elif os.path.splitext(mypath)[1].lower() == '.h5': 
     2597                # Make sure the ext included in the file name 
     2598                # especially on MAC 
     2599                fileName = os.path.splitext(path)[0] + ext_format 
     2600                nxcansaswriter = NXcanSASWriter() 
     2601                nxcansaswriter.write([data], fileName) 
    25932602            try: 
    25942603                self._default_save_location = os.path.dirname(path) 
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    r2924532 r02c1608e  
    239239            self.load_complete(output=output, message="Loading data complete!", 
    240240                               info="info") 
    241         else: 
    242             self.load_complete(output=None, message=error_message, info="error") 
    243241 
    244242    def load_update(self, message="", info="warning"): 
  • test/sasdataloader/test/test_data/avg_testdata.txt

    r8c9ffde r7fd5e2a  
    110.00019987186878 -0.01196215 0.148605728355 
    2 0.000453772721237 0.02091606 0.0680283029334 
    3 0.000750492390439 -0.01337855 0.0444902910757 
    4 0.00103996394336 0.03062 0.0580312894528 
    5 0.0013420198959 0.0811008333333 0.0540469289108 
    6 0.001652061869 0.167022288372 0.0651891320031 
    7 0.00196086470492 27.5554711176 0.735053300957 
     20.000453772721237 0.02091606 0.23372601 
     30.000750492390439 -0.01337855 0.17169562 
     40.00103996394336 0.03062 0.13136407 
     50.0013420198959 0.0811008333333 0.10681163 
     60.001652061869 0.167022288372 0.10098903 
     70.00196086470492 27.5554711176 0.7350533 
    880.00226262401224 105.031578947 1.35744586624 
    990.00256734439716 82.1791776119 1.10749938588 
  • test/sasdataloader/test/test_data/ring_testdata.txt

    r400155b r7fd5e2a  
    440.628318530718 0.964040908176 0.0790933208542 
    550.942477796077 0.922142905769 0.0781616076625 
    6 1.25663706144 1.02710537736 0.080875897538 
     61.25663706144 1.02710537736 0.08136351514804 
    771.57079632679 1.01448978075 0.0808313893873 
    881.88495559215 1.04677136013 0.0828850195035 
  • test/sasdataloader/test/test_data/sectorphi_testdata.txt

    r8c9ffde r7fd5e2a  
    13130.981747704247 0.893411561538 0.151685984204 
    14141.06028752059 0.86231787 0.152618707077 
    15 1.13882733693 1.0607364925 0.164276150316 
     151.13882733693 1.0607364925 0.166167546658 
    16161.21736715327 1.0684421475 0.163649496829 
    17 1.29590696961 1.09330437436 0.167871645263 
     171.29590696961 1.09330437436 0.16981858402 
    18181.37444678595 0.88759347 0.150974201439 
    19191.45298660229 1.1352002 0.172191803977 
  • test/sasdataloader/test/test_data/sectorq_testdata.txt

    r8c9ffde r7fd5e2a  
    17170.00913119845523 0.405669568421 0.0705339106673 
    18180.00938052380065 0.331241946 0.061307573431 
    19 0.00962825731078 0.237315993939 0.0578654769893 
     190.00962825731078 0.237315993939 0.059602636160850493 
    20200.00987552050718 0.296916590385 0.0592796733987 
  • test/sasdataloader/test/test_data/slabx_testdata.txt

    r8c9ffde r7fd5e2a  
    2121-0.00184475260646 2.40154 1.09579651396 
    2222-0.00143541414791 0.065281 0.198049867458 
    23 -0.00102607559383 -0.04767235 0.154389685536 
    24 -0.000616736954402 -0.0090503 0.0960105462957 
     23-0.00102607559383 -0.04767235 0.52329358394690839 
     24-0.000616736954402 -0.0090503 0.36635778277525377 
    2525-0.000207398273925 0.03109325 0.246629023029 
    26 0.000201940423805 -0.027508775 0.082928847514 
     260.000201940423805 -0.027508775 0.36314899662535211 
    27270.000611279108096 0.03251315 0.246951260373 
    28 0.00102061774154 -0.00987975 0.144233534589 
    29 0.00142995630705 0.075937 0.19485507435 
     280.00102061774154 -0.00987975 0.38184199939241886 
     290.00142995630705 0.075937 0.53662696540520582 
    30300.00183929475361 10.60918375 1.62858709853 
    31310.00224863307777 106.2485 7.2886384188 
  • test/sasdataloader/test/test_data/slaby_testdata.txt

    r8c9ffde r7fd5e2a  
    1 -0.00981587154747 0.197046827778 0.0872226309261 
     1-0.00981587154747 0.197046827778 0.09153902 
    22-0.00940654133769 0.2466434 0.124972263589 
    33-0.0089972103454 0.218745969444 0.0838510368061 
    44-0.00858787875434 0.126093522222 0.107482002513 
    5 -0.00817854644886 0.310427366667 0.100945289852 
     5-0.00817854644886 0.310427366667 0.10469745 
    66-0.0077692135991 0.0843802722222 0.103942898914 
    77-0.00735988010303 0.246036369444 0.0916479235889 
  • test/sasdataloader/test/utest_averaging.py

    rf53d684 r7fd5e2a  
    106106 
    107107    def setUp(self): 
    108         filepath = find('MAR07232_rest.h5') 
     108        filepath = find('test_data//MAR07232_rest.h5') 
    109109        self.data_list = Loader().load(filepath) 
    110110        self.data = self.data_list[0] 
     
    121121 
    122122        o = r(self.data) 
    123         filepath = find('ring_testdata.txt') 
     123        filepath = find('test_data//ring_testdata.txt') 
    124124        answer_list = Loader().load(filepath) 
    125125        answer = answer_list[0] 
     
    142142        o = r(self.data) 
    143143 
    144         filepath = find('avg_testdata.txt') 
     144        filepath = find('test_data//avg_testdata.txt') 
    145145        answer = Loader().load(filepath)[0] 
    146146        for i in range(r.nbins_phi): 
     
    158158        s, ds, npoints = r(self.data) 
    159159        self.assertAlmostEqual(s, 34.278990899999997, 4) 
    160         self.assertAlmostEqual(ds, 7.8007981835194293, 4) 
     160        self.assertAlmostEqual(ds, 8.237259999538685, 4) 
    161161        self.assertAlmostEqual(npoints, 324.0000, 4) 
    162162 
     
    164164        s, ds = r(self.data) 
    165165        self.assertAlmostEqual(s, 0.10579935462962962, 4) 
    166         self.assertAlmostEqual(ds, 0.024076537603455028, 4) 
     166        self.assertAlmostEqual(ds, 0.02542364197388483, 4) 
    167167 
    168168    def test_slabX(self): 
     
    177177        o = r(self.data) 
    178178 
    179         filepath = find('slabx_testdata.txt') 
     179        filepath = find('test_data//slabx_testdata.txt') 
    180180        answer = Loader().load(filepath)[0] 
    181181        for i in range(len(o.x)): 
     
    195195        o = r(self.data) 
    196196 
    197         filepath = find('slaby_testdata.txt') 
     197        filepath = find('test_data//slaby_testdata.txt') 
    198198        answer = Loader().load(filepath)[0] 
    199199        for i in range(len(o.x)): 
     
    221221        o = r(self.data) 
    222222 
    223         filepath = find('ring_testdata.txt') 
     223        filepath = find('test_data//ring_testdata.txt') 
    224224        answer = Loader().load(filepath)[0] 
    225225        for i in range(len(o.x)): 
     
    238238        o = r(self.data) 
    239239 
    240         filepath = find('sectorphi_testdata.txt') 
     240        filepath = find('test_data//sectorphi_testdata.txt') 
    241241        answer = Loader().load(filepath)[0] 
    242242        for i in range(len(o.x)): 
     
    255255        o = r(self.data) 
    256256 
    257         filepath = find('sectorq_testdata.txt') 
     257        filepath = find('test_data//sectorq_testdata.txt') 
    258258        answer = Loader().load(filepath)[0] 
    259259        for i in range(len(o.x)): 
  • test/sasdataloader/test/utest_cansas.py

    rf53d684 r7fd5e2a  
    9191        reader = XMLreader(self.xml_valid, self.schema_1_0) 
    9292        valid = reader.validate_xml() 
    93         if valid: 
    94             self.assertTrue(valid) 
    95         else: 
    96             self.assertFalse(valid) 
     93        self.assertTrue(valid) 
    9794 
    9895    def _check_data(self, data): 
     
    193190    def test_save_cansas_v1_0(self): 
    194191        xmlreader = XMLreader(self.isis_1_0, self.schema_1_0) 
    195         valid = xmlreader.validate_xml() 
    196         self.assertTrue(valid) 
     192        self.assertTrue(xmlreader.validate_xml()) 
    197193        reader_generic = Loader() 
    198194        dataloader = reader_generic.load(self.isis_1_0) 
     
    207203            return_data = reader2.read(self.write_1_0_filename) 
    208204            written_data = return_data[0] 
    209             XMLreader(self.write_1_0_filename, self.schema_1_0) 
    210             valid = xmlreader.validate_xml() 
    211             self.assertTrue(valid) 
     205            xmlreader = XMLreader(self.write_1_0_filename, self.schema_1_0) 
     206            self.assertTrue(xmlreader.validate_xml()) 
    212207            self._check_data(written_data) 
    213208        if os.path.isfile(self.write_1_0_filename): 
     
    260255        self.loader = Loader() 
    261256        self.datafile_basic = find("simpleexamplefile.h5") 
    262         self.datafile_multiplesasentry = find("cansas_1Dand2D_samedatafile.h5") 
    263         self.datafile_multiplesasdata = find("cansas_1Dand2D_samesasentry.h5") 
    264         self.datafile_multiplesasdata_multiplesasentry = find("cansas_1Dand2D_multiplesasentry_multiplesasdata.h5") 
     257        self.datafile_multiplesasentry = find( 
     258            "test_data//nxcansas_1Dand2D_multisasdata.h5") 
     259        self.datafile_multiplesasdata = find( 
     260            "test_data//nxcansas_1Dand2D_multisasentry.h5") 
     261        self.datafile_multiplesasdata_multiplesasentry = find( 
     262            "test_data//nxcansas_1Dand2D_multisasentry_multisasdata.h5") 
    265263 
    266264    def test_real_data(self): 
     
    273271        self._check_multiple_data(self.data[0]) 
    274272        self._check_multiple_data(self.data[1]) 
    275         self._check_1d_data(self.data[0]) 
     273        if isinstance(self.data[0], Data1D): 
     274            self._check_1d_data(self.data[0]) 
     275            self._check_2d_data(self.data[1]) 
     276        else: 
     277            self._check_1d_data(self.data[1]) 
     278            self._check_2d_data(self.data[0]) 
    276279 
    277280    def _check_multiple_data(self, data): 
     
    281284        self.assertTrue(data.instrument == "SANS2D") 
    282285        self.assertTrue(data.source.radiation == "Spallation Neutron Source") 
    283         self.assertTrue(len(data.detector) == 1) 
    284         self.assertTrue(data.detector[0].name == "rear-detector") 
    285         self.assertTrue(data.detector[0].distance == 4.385281) 
    286         self.assertTrue(data.detector[0].distance_unit == 'm') 
     286        self.assertTrue(len(data.detector) == 2) 
     287        self.assertTrue(data.detector[0].name == "rear-detector" 
     288                        or data.detector[1].name == "rear-detector") 
     289        self.assertTrue(data.detector[0].name == "front-detector" 
     290                        or data.detector[1].name == "front-detector") 
     291        self.assertAlmostEqual(data.detector[0].distance + 
     292                               data.detector[1].distance, 7230.54, 2) 
     293        self.assertTrue(data.detector[0].distance_unit == 'mm') 
    287294        self.assertTrue(len(data.trans_spectrum) == 1) 
    288295 
    289296    def _check_1d_data(self, data): 
    290         self.assertTrue(isinstance(data, Data1D)) 
    291297        self.assertTrue(len(data.x) == 66) 
    292298        self.assertTrue(len(data.x) == len(data.y)) 
    293         self.assertTrue(data.dy[10] == 0.20721350111248701) 
    294         self.assertTrue(data.y[10] == 24.193889608153476) 
    295         self.assertTrue(data.x[10] == 0.008981127988654792) 
     299        self.assertTrue(data.dy[10] == 0.207214) 
     300        self.assertTrue(data.y[10] == 24.1939) 
     301        self.assertTrue(data.x[10] == 0.00898113) 
    296302 
    297303    def _check_2d_data(self, data): 
    298304        self.assertTrue(isinstance(data, Data2D)) 
    299         self.assertTrue(len(data.x) == 66) 
    300         self.assertTrue(len(data.x) == len(data.y)) 
    301         self.assertTrue(data.dy[10] == 0.20721350111248701) 
    302         self.assertTrue(data.y[10] == 24.193889608153476) 
    303         self.assertTrue(data.x[10] == 0.008981127988654792) 
     305        self.assertTrue(len(data.q_data) == 150*150) 
     306        self.assertTrue(len(data.q_data) == len(data.data)) 
     307        print(data.err_data[10]) 
     308        self.assertAlmostEqual(data.err_data[10], 0.186723989418) 
     309        self.assertAlmostEqual(data.data[10], 0.465181425808) 
     310        self.assertAlmostEqual(data.qx_data[10], -0.129) 
     311        self.assertAlmostEqual(data.qy_data[10], -0.149) 
    304312 
    305313    def _check_example_data(self, data): 
  • test/sasdataloader/test/utest_red2d_reader.py

    rf53d684 rfc51d06  
    3131        self.assertEqual(f.qx_data[0],-0.03573497) 
    3232        self.assertEqual(f.qx_data[36863],0.2908819) 
    33         self.assertEqual(f.Q_unit, '1/A') 
    34         self.assertEqual(f.I_unit, '1/cm') 
     33        self.assertEqual(f.Q_unit, 'A^{-1}') 
     34        self.assertEqual(f.I_unit, 'cm^{-1}') 
    3535 
    3636        self.assertEqual(f.meta_data['loader'],"IGOR/DAT 2D Q_map") 
Note: See TracChangeset for help on using the changeset viewer.