Changeset 21e71f1 in sasview for src/sas/sascalc


Ignore:
Timestamp:
Nov 21, 2018 8:39:24 AM (6 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
f2e199e
Parents:
44c15fc (diff), fb39f28 (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 'ESS_GUI_project_save' into ESS_GUI

Location:
src/sas/sascalc
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    rb8080e1 rb1b71ad  
    184184            if CANSAS_NS.get(self.cansas_version).get("ns") == value.rsplit(" ")[0]: 
    185185                return True 
    186         if ext == "svs": 
     186        if ext == ".svs": 
    187187            return True # Why is this required? 
    188188        # If we get to this point then file isn't valid CanSAS 
  • src/sas/sascalc/fit/pagestate.py

    rb8080e1 rb1b71ad  
    12491249 
    12501250            else: 
    1251                 self.call_back(format=ext) 
     1251                #self.call_back(format=ext) 
    12521252                raise RuntimeError("%s is not a file" % path) 
    12531253 
    12541254            # Return output consistent with the loader's api 
    12551255            if len(output) == 0: 
    1256                 self.call_back(state=None, datainfo=None, format=ext) 
     1256                #self.call_back(state=None, datainfo=None, format=ext) 
    12571257                return None 
    12581258            else: 
     1259                states=[] 
    12591260                for data in output: 
    12601261                    # Call back to post the new state 
     
    12811282                        if isinstance(data.run_name, dict): 
    12821283                            # Note: key order in dict is not guaranteed, so sort 
    1283                             name = data.run_name.keys()[0] 
     1284                            name = list(data.run_name.keys())[0] 
    12841285                        else: 
    12851286                            name = data.run_name 
     
    12891290                    state.version = fitstate.version 
    12901291                    # store state in fitting 
    1291                     self.call_back(state=state, datainfo=data, format=ext) 
     1292                    #self.call_back(state=state, datainfo=data, format=ext) 
    12921293                    self.state = state 
     1294                    states.append(state) 
    12931295                simfitstate = self._parse_simfit_state(entry) 
    12941296                if simfitstate is not None: 
    1295                     self.call_back(state=simfitstate) 
    1296  
    1297                 return output 
     1297                    #self.call_back(state=simfitstate) 
     1298                    states.append(simfitstate) 
     1299                return (output, states) 
    12981300        except: 
    1299             self.call_back(format=ext) 
     1301            #self.call_back(format=ext) 
    13001302            raise 
    13011303 
  • src/sas/sascalc/dataloader/file_reader_base_class.py

    rb8080e1 rbe7c981  
    276276                    dataset.xmax = np.max(dataset.qx_data) 
    277277                    dataset.ymin = np.min(dataset.qy_data) 
    278                     dataset.ymax = np.max(dataset.qx_data) 
     278                    dataset.ymax = np.max(dataset.qy_data) 
    279279 
    280280    def format_unit(self, unit=None): 
  • src/sas/sascalc/pr/fit/BumpsFitting.py

    r9a5097c r57a91fc  
    22BumpsFitting module runs the bumps optimizer. 
    33""" 
     4from __future__ import division 
     5 
    46import os 
    57from datetime import timedelta, datetime 
     
    3436class Progress(object): 
    3537    def __init__(self, history, max_step, pars, dof): 
    36         remaining_time = int(history.time[0]*(float(max_step)/history.step[0]-1)) 
     38        remaining_time = int(history.time[0]*(max_step/history.step[0]-1)) 
    3739        # Depending on the time remaining, either display the expected 
    3840        # time of completion, or the amount of time remaining.  Use precision 
  • src/sas/sascalc/pr/fit/Loader.py

    r574adc7 r57a91fc  
     1""" 
     2class Loader  to load any kind of file 
     3""" 
     4 
    15from __future__ import print_function 
    26 
    3 # class Loader  to load any king of file 
    4 #import wx 
    5 #import string 
    67import numpy as np 
    78 
  • src/sas/sascalc/pr/invertor.py

    raed159f r57a91fc  
    66FIXME: The way the Invertor interacts with its C component should be cleaned up 
    77""" 
     8from __future__ import division 
    89 
    910import numpy as np 
     
    423424            A[i][j] = (Fourier transformed base function for point j) 
    424425 
    425         We them choose a number of r-points, n_r, to evaluate the second 
     426        We then choose a number of r-points, n_r, to evaluate the second 
    426427        derivative of P(r) at. This is used as our regularization term. 
    427428        For a vector r of length n_r, the following n_r rows are set to :: 
     
    480481 
    481482        # Perform the inversion (least square fit) 
    482         c, chi2, _, _ = lstsq(a, b) 
     483        c, chi2, _, _ = lstsq(a, b, rcond=-1) 
    483484        # Sanity check 
    484485        try: 
     
    503504        try: 
    504505            cov = np.linalg.pinv(inv_cov) 
    505             err = math.fabs(chi2 / float(npts - nfunc)) * cov 
    506         except: 
     506            err = math.fabs(chi2 / (npts - nfunc)) * cov 
     507        except Exception as exc: 
    507508            # We were not able to estimate the errors 
    508509            # Return an empty error matrix 
     
    548549        try: 
    549550            return estimator.num_terms(isquit_func) 
    550         except: 
     551        except Exception as exc: 
    551552            # If we fail, estimate alpha and return the default 
    552553            # number of terms 
  • src/sas/sascalc/pr/num_term.py

    rb8080e1 r57a91fc  
    1 from __future__ import print_function 
     1from __future__ import print_function, division 
    22 
    33import math 
     
    5151        osc = self.sort_osc() 
    5252        dv = len(osc) 
    53         med = float(dv) / 2.0 
     53        med = 0.5*dv 
    5454        odd = self.is_odd(dv) 
    5555        medi = 0 
     
    140140            nts = self.compare_err() 
    141141            div = len(nts) 
    142             tem = float(div) / 2.0 
     142            tem = 0.5*div 
    143143            if self.is_odd(div): 
    144144                nt = nts[int(tem)] 
Note: See TracChangeset for help on using the changeset viewer.