Changeset a86e249 in sasmodels


Ignore:
Timestamp:
Apr 8, 2017 11:11:29 AM (6 months ago)
Author:
jhbakker
Branches:
costrafo411
Children:
7c1cce3
Parents:
e4e5e29
Message:

isgood

Files:
8 added
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sesans.py

    re4e5e29 ra86e249  
    4545        #import logging; logging.info("creating SESANS transform") 
    4646        self.q = z 
    47         # isoriented flag determines whether data is from an oriented sample or not, should be in the data or selectable in GUI. 
    48         #if self.isoriented==False 
    49         self._set_hankel(SElength, zaccept, Rmax) 
    50         #if self.isoriented==True 
    51         self._set_cosmat(SElength, zaccept, Rmax) 
     47        # isoriented flag determines whether data is from an oriented sample or not, should be a selection variable upon entering SESANS data. 
     48        if self.isoriented==False: 
     49            self._set_hankel(SElength, zaccept, Rmax) 
     50        if self.isoriented==True: 
     51            self._set_cosmat(SElength, zaccept, Rmax) 
    5252 
    5353    def apply(self, Iq): 
    54         if len(Iq.size) == 1: # if isotropic, do Hankel transform 
    55             # type: (np.ndarray) -> np.ndarray 
     54        try: 
    5655            G0 = np.dot(self._H0, Iq) 
    5756            G = np.dot(self._H.T, Iq) 
    5857            P = G - G0 
    59         elif len(Iq.size) == 2: 
    60             dq=self.q_calc[0] 
    61             G0 = sum(np.dot(self._cos0, Iq)*dq) 
    62             G = sum(np.dot(self._cosmat.T, Iq)*dq) 
    63             P = G - G0 
     58        except: 
     59            try: 
     60                dq = self.q_calc[0] 
     61                G0 = sum(np.dot(self._cos0, Iq) * dq) 
     62                G = sum(np.dot(self._cosmat.T, Iq) * dq) 
     63                P = G - G0 
     64            except: 
     65                raise ValueError('Sesanstransform.apply cannot generate either a Hankel transform or a cosine transform of you SESANS data') 
    6466        return P 
    6567 
     
    8890        # Force float32 arrays, otherwise run into memory problems on some machines 
    8991        SElength = np.asarray(SElength, dtype='float32') 
    90         #qymax and qzmax depend on detector shape 
    91         qzmax= 
     92 
    9293        # Rmax = #value in text box somewhere in FitPage? 
    9394        q_max = 2 * pi / (SElength[1] - SElength[0]) 
Note: See TracChangeset for help on using the changeset viewer.