Changeset 3b8cc00 in sasview for src/sas/qtgui/Utilities/GuiUtils.py


Ignore:
Timestamp:
Apr 25, 2018 4:32:11 AM (5 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
27689dc
Parents:
01ef3f7
Message:

Code review changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Utilities/GuiUtils.py

    rbb57068 r3b8cc00  
    1010import webbrowser 
    1111import urllib.parse 
     12 
     13import numpy as np 
    1214 
    1315warnings.simplefilter("ignore") 
     
    926928        input = input.replace(",", "") 
    927929 
     930def checkModel(path): 
     931    """ 
     932    Check that the model save in file 'path' can run. 
     933    """ 
     934    # try running the model 
     935    from sasmodels.sasview_model import load_custom_model 
     936    Model = load_custom_model(path) 
     937    model = Model() 
     938    q =  np.array([0.01, 0.1]) 
     939    _ = model.evalDistribution(q) 
     940    qx, qy =  np.array([0.01, 0.01]), np.array([0.1, 0.1]) 
     941    _ = model.evalDistribution([qx, qy]) 
     942 
     943    # check the model's unit tests run 
     944    from sasmodels.model_test import run_one 
     945    # TestSuite module in Qt5 now deletes tests in the suite after running, 
     946    # so suite[0] in run_one() in sasmodels/model_test.py will contain [None] and 
     947    # test.info.tests will raise. 
     948    # Not sure how to change the behaviour here, most likely sasmodels will have to 
     949    # be modified 
     950    result = run_one(path) 
     951 
     952    return result 
     953 
    928954 
    929955def enum(*sequential, **named): 
Note: See TracChangeset for help on using the changeset viewer.