Changeset ca10d8e in sasview


Ignore:
Timestamp:
Feb 11, 2009 4:12:47 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
acb37d9
Parents:
1309e919
Message:

reverse code from version 1237 with modification on output axis unit

Location:
DataLoader
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • DataLoader/data_info.py

    r2e9b98c rca10d8e  
    154154    ## Slit length of the instrument for this detector.[float] [mm] 
    155155    slit_length = None 
     156    #slit_length_unit = '1/A' 
    156157    slit_length_unit = 'mm' 
    157158     
     
    541542        1D data class 
    542543    """ 
    543     x_unit = 'A^{-1}' 
    544     y_unit = 'cm^{-1}' 
     544    x_unit = '1/A' 
     545    y_unit = '1/cm' 
    545546     
    546547    def __init__(self, x, y, dx=None, dy=None): 
     
    660661    """ 
    661662    ## Units for Q-values 
    662     Q_unit = 'A^{-1}' 
     663    Q_unit = '1/A' 
    663664     
    664665    ## Units for I(Q) values 
    665     I_unit = 'cm^{-1}' 
     666    I_unit = '1/cm' 
    666667     
    667668    ## Vector of Q-values at the center of each bin in x 
  • DataLoader/manipulations.py

    r923d926 rca10d8e  
    231231        err_y = 0.0 
    232232        y_counts = 0.0 
    233                  
     233        sign=1 
    234234        for i in range(numpy.size(data2D.data,1)): 
    235235            # Min and max x-value for the pixel 
    236236            minx = pixel_width_x*(i - center_x) 
    237237            maxx = pixel_width_x*(i+1.0 - center_x) 
    238              
    239             qxmin = get_q(minx, 0.0, det_dist, wavelength) 
    240             qxmax = get_q(maxx, 0.0, det_dist, wavelength) 
     238            if minx>=0: 
     239                sign=1 
     240            else: 
     241                sign=-1            
     242            qxmin = sign*get_q(minx, 0.0, det_dist, wavelength) 
     243            if maxx>=0: 
     244                sign=1 
     245            else: 
     246                sign=-1 
     247            qxmax = sign*get_q(maxx, 0.0, det_dist, wavelength) 
    241248             
    242249            # Get the count fraction in x for that pixel 
     
    249256                miny = pixel_width_y*(j - center_y) 
    250257                maxy = pixel_width_y*(j+1.0 - center_y) 
    251  
    252                 qymin = get_q(0.0, miny, det_dist, wavelength) 
    253                 qymax = get_q(0.0, maxy, det_dist, wavelength) 
     258                if miny>=0: 
     259                    sign=1 
     260                else: 
     261                    sign=-1            
     262 
     263                qymin = sign*get_q(0.0, miny, det_dist, wavelength) 
     264                if maxy>=0: 
     265                    sign=1 
     266                else: 
     267                    sign=-1            
     268                 
     269                qymax = sign*get_q(0.0, maxy, det_dist, wavelength) 
    254270                 
    255271                # Get the count fraction in x for that pixel 
  • DataLoader/readers/IgorReader.py

    rb568ec1b rca10d8e  
    7979        data_conv_i = None 
    8080         
    81         if has_converter == True and output.Q_unit != 'A^{-1}': 
    82             data_conv_q = Converter('A^{-1}') 
     81        if has_converter == True and output.Q_unit != '1/A': 
     82            data_conv_q = Converter('1/A') 
    8383            # Test it 
    8484            data_conv_q(1.0, output.Q_unit) 
    8585             
    86         if has_converter == True and output.I_unit != 'cm^{-1}': 
    87             data_conv_i = Converter('cm^{-1}') 
     86        if has_converter == True and output.I_unit != '1/cm': 
     87            data_conv_i = Converter('1/cm') 
    8888            # Test it 
    8989            data_conv_i(1.0, output.I_unit)             
     
    191191                qx = 4.0*math.pi/wavelength * math.sin(theta/2.0) 
    192192 
    193                 if has_converter == True and output.Q_unit != 'A^{-1}': 
     193                if has_converter == True and output.Q_unit != '1/A': 
    194194                    qx = data_conv_q(qx, units=output.Q_unit) 
    195195 
     
    202202                qy = 4.0*math.pi/wavelength * math.sin(theta/2.0) 
    203203 
    204                 if has_converter == True and output.Q_unit != 'A^{-1}': 
     204                if has_converter == True and output.Q_unit != '1/A': 
    205205                    qy = data_conv_q(qy, units=output.Q_unit) 
    206206                 
     
    258258        ymin    =ymin-ystep/2.0 
    259259        ymax    =ymax+ystep/2.0 
    260         if has_converter == True and output.Q_unit != 'A^{-1}': 
     260        if has_converter == True and output.Q_unit != '1/A': 
    261261            xmin = data_conv_q(xmin, units=output.Q_unit) 
    262262            xmax = data_conv_q(xmax, units=output.Q_unit) 
  • DataLoader/readers/abs_reader.py

    rd06ba5e rca10d8e  
    6262                data_conv_i = None 
    6363                 
    64                 if has_converter == True and output.x_unit != 'A^{-1}': 
    65                     data_conv_q = Converter('A^{-1}') 
     64                if has_converter == True and output.x_unit != '1/A': 
     65                    data_conv_q = Converter('1/A') 
    6666                    # Test it 
    6767                    data_conv_q(1.0, output.x_unit) 
    6868                     
    69                 if has_converter == True and output.y_unit != 'cm^{-1}': 
    70                     data_conv_i = Converter('cm^{-1}') 
     69                if has_converter == True and output.y_unit != '1/cm': 
     70                    data_conv_i = Converter('1/cm') 
    7171                    # Test it 
    7272                    data_conv_i(1.0, output.y_unit) 
  • DataLoader/readers/ascii_reader.py

    rb92c1ad0 rca10d8e  
    5858                data_conv_i = None 
    5959                 
    60                 if has_converter == True and output.x_unit != 'A^{-1}': 
    61                     data_conv_q = Converter('A^{-1}') 
     60                if has_converter == True and output.x_unit != '1/A': 
     61                    data_conv_q = Converter('1/A') 
    6262                    # Test it 
    6363                    data_conv_q(1.0, output.x_unit) 
    6464                     
    65                 if has_converter == True and output.y_unit != 'cm^{-1}': 
    66                     data_conv_i = Converter('cm^{-1}') 
     65                if has_converter == True and output.y_unit != '1/cm': 
     66                    data_conv_i = Converter('1/cm') 
    6767                    # Test it 
    6868                    data_conv_i(1.0, output.y_unit) 
  • DataLoader/readers/cansas_reader.py

    r2bc8d4a rca10d8e  
    569569        data_conv_i = None 
    570570         
    571         if has_converter == True and data_info.x_unit != 'A^{-1}': 
    572             data_conv_q = Converter('A^{-1}') 
     571        if has_converter == True and data_info.x_unit != '1/A': 
     572            data_conv_q = Converter('1/A') 
    573573            # Test it 
    574574            data_conv_q(1.0, output.Q_unit) 
    575575             
    576         if has_converter == True and data_info.y_unit != 'cm^{-1}': 
    577             data_conv_i = Converter('cm^{-1}') 
     576        if has_converter == True and data_info.y_unit != '1/cm': 
     577            data_conv_i = Converter('1/cm') 
    578578            # Test it 
    579579            data_conv_i(1.0, output.I_unit)                     
  • DataLoader/readers/danse_reader.py

    reeaabb1 rca10d8e  
    8787            data_conv_i = None 
    8888             
    89             if has_converter == True and output.Q_unit != 'A^{-1}': 
    90                 data_conv_q = Converter('A^{-1}') 
     89            if has_converter == True and output.Q_unit != '1/A': 
     90                data_conv_q = Converter('1/A') 
    9191                # Test it 
    9292                data_conv_q(1.0, output.Q_unit) 
    9393                 
    94             if has_converter == True and output.I_unit != 'cm^{-1}': 
    95                 data_conv_i = Converter('cm^{-1}') 
     94            if has_converter == True and output.I_unit != '1/cm': 
     95                data_conv_i = Converter('1/cm') 
    9696                # Test it 
    9797                data_conv_i(1.0, output.I_unit)             
     
    161161                qx = 4.0*math.pi/wavelength * math.sin(theta/2.0) 
    162162                 
    163                 if has_converter == True and output.Q_unit != 'A^{-1}': 
     163                if has_converter == True and output.Q_unit != '1/A': 
    164164                    qx = data_conv_q(qx, units=output.Q_unit) 
    165165                 
    166166                x_vals.append(qx) 
    167                 if xmin==None or qx<=xmin: 
     167                if xmin==None or qx<xmin: 
    168168                    xmin = qx 
    169                 if xmax==None or qx>=xmax: 
     169                if xmax==None or qx>xmax: 
    170170                    xmax = qx 
    171171             
     
    176176                qy = 4.0*math.pi/wavelength * math.sin(theta/2.0) 
    177177                 
    178                 if has_converter == True and output.Q_unit != 'A^{-1}': 
     178                if has_converter == True and output.Q_unit != '1/A': 
    179179                    qy = data_conv_q(qy, units=output.Q_unit) 
    180180                 
     
    242242            ymax    =ymax+stepq/2.0 
    243243             
    244             if has_converter == True and output.Q_unit != 'A^{-1}': 
     244            if has_converter == True and output.Q_unit != '1/A': 
    245245                xmin = data_conv_q(xmin, units=output.Q_unit) 
    246246                xmax = data_conv_q(xmax, units=output.Q_unit) 
  • DataLoader/readers/hfir1d_reader.py

    rc5f0337 rca10d8e  
    5858                data_conv_i = None 
    5959                 
    60                 if has_converter == True and output.x_unit != 'A^{-1}': 
    61                     data_conv_q = Converter('A^{-1}') 
     60                if has_converter == True and output.x_unit != '1/A': 
     61                    data_conv_q = Converter('1/A') 
    6262                    # Test it 
    6363                    data_conv_q(1.0, output.x_unit) 
    6464                     
    65                 if has_converter == True and output.y_unit != 'cm^{-1}': 
    66                     data_conv_i = Converter('cm^{-1}') 
     65                if has_converter == True and output.y_unit != '1/cm': 
     66                    data_conv_i = Converter('1/cm') 
    6767                    # Test it 
    6868                    data_conv_i(1.0, output.y_unit) 
Note: See TracChangeset for help on using the changeset viewer.