Changeset 65883cf in sasview for DataLoader/extensions


Ignore:
Timestamp:
Sep 21, 2009 8:32:18 PM (15 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
a0bc608
Parents:
a65ffcb
Message:

dataloader: fixed get_bin_range method for smearer objects

Location:
DataLoader/extensions
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • DataLoader/extensions/smearer.cpp

    r5859862 r65883cf  
    230230 * 
    231231 */ 
    232 void BaseSmearer :: get_bin_range(int i, double* q, double* q_min, double* q_max) { 
     232int BaseSmearer :: get_bin_range(int i, double* q, double* q_min, double* q_max) { 
    233233        if (even_binning) { 
    234234                double step = (qmax-qmin)/((double)nbins-1.0); 
     
    236236                *q_min = *q - 0.5*step; 
    237237                *q_max = *q + 0.5*step; 
    238         } else { 
     238                return 1; 
     239        } else if (i>=0 && i<nbins) { 
    239240                *q = q_values[i]; 
    240241                if (i==0) { 
     
    250251                        *q_max = *q + (q_values[i+1]-q_values[i])/2.0; 
    251252                } 
    252         } 
     253                return 1; 
     254        } 
     255        return -1; 
    253256} 
    254257 
  • DataLoader/extensions/smearer.hh

    r5859862 r65883cf  
    5050        int get_nbins() { return nbins; } 
    5151        // Get the q range of a particular bin 
    52         virtual void get_bin_range(int, double*, double*, double*); 
     52        virtual int get_bin_range(int, double*, double*, double*); 
    5353}; 
    5454 
  • DataLoader/extensions/smearer_module.cpp

    r5859862 r65883cf  
    161161        BaseSmearer* s = static_cast<BaseSmearer *>(temp); 
    162162 
     163        if(s->get_nbins()<=0 || s->get_nbins()<=bin) { 
     164                return NULL; 
     165        } 
     166 
    163167        double q, q_min, q_max; 
    164         s->get_bin_range(bin, &q, &q_min, &q_max); 
    165  
     168        if (s->get_bin_range(bin, &q, &q_min, &q_max)<0) { 
     169                return NULL; 
     170        } 
    166171        return Py_BuildValue("d", q); 
    167172} 
Note: See TracChangeset for help on using the changeset viewer.