Changeset deddda1 in sasview for src/sas/sascalc/calculator


Ignore:
Timestamp:
Aug 10, 2016 7:32:49 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
801a296
Parents:
d2fd8fc
Message:

sort paramList if params not in ordered dict

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/calculator/BaseComponent.py

    rcb4ef58 rdeddda1  
    77# imports 
    88import copy 
     9from collections import OrderedDict 
     10 
    911import numpy 
    1012#TO DO: that about a way to make the parameter 
     
    254256        Return a list of all available parameters for the model 
    255257        """ 
    256         list = self.params.keys() 
     258        list = _ordered_keys(self.params) 
    257259        # WARNING: Extending the list with the dispersion parameters 
    258260        list.extend(self.getDispParamList()) 
     
    264266        """ 
    265267        list = [] 
    266  
    267         for item in self.dispersion.keys(): 
    268             for p in self.dispersion[item].keys(): 
     268        for item in _ordered_keys(self.dispersion): 
     269            for p in _ordered_keys(self.dispersion[item]): 
    269270                if p not in ['type']: 
    270271                    list.append('%s.%s' % (item.lower(), p.lower())) 
     
    309310        """ 
    310311        raise ValueError, "Model operation are no longer supported" 
     312 
     313 
     314def _ordered_keys(d): 
     315    keys = list(d.keys()) 
     316    if not isinstance(d, OrderedDict): 
     317        keys.sort() 
     318    return keys 
Note: See TracChangeset for help on using the changeset viewer.