Ignore:
Timestamp:
Dec 9, 2016 1:52:27 PM (8 years ago)
Author:
krzywon
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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
8aec639
Parents:
9eb8fae
Message:

#795: String parameters are now handled properly. Try/except blocks that gave save state compatibility from SasView? v2.2.1 to v3.0.0 were removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/pagestate.py

    r9eb8fae r0633048  
    392392                self.formfactorcombobox = 'hardsphere' 
    393393 
    394     def param_remap_to_sasmodels_convert(self, params): 
     394    def param_remap_to_sasmodels_convert(self, params, is_string=False): 
    395395        """ 
    396396        Remaps the parameters for sasmodels conversion 
     
    412412                lower[0] = False 
    413413                lower[1] = numpy.nan 
    414             p[name] = float(value) 
     414            if is_string: 
     415                p[name] = str(value) 
     416            else: 
     417                p[name] = float(value) 
    415418            p[name + ".fittable"] = bool(fittable) 
    416419            p[name + ".std"] = float(uncert[1]) 
     
    468471            convert.convert_model(self.formfactorcombobox, params) 
    469472        if len(self.str_parameters) > 0: 
    470             str_p = self.param_remap_to_sasmodels_convert(self.str_parameters) 
    471             formfactor, str_params = convert.convert_model(formfactor, str_p) 
    472         else: 
    473             str_params = None 
     473            str_pars = self.param_remap_to_sasmodels_convert( 
     474                self.str_parameters, True) 
     475            formfactor, str_params = convert.convert_model( 
     476                self.formfactorcombobox, str_pars) 
     477            for key, value in str_params.iteritems(): 
     478                params[key] = value 
    474479 
    475480        # Only convert if old != new, otherwise all the same 
    476481        if formfactor != self.formfactorcombobox or \ 
    477482                        structurefactor != self.structurecombobox: 
     483            # Spherical SLD number of layers changed between 3.1.2 and 4.0 
     484            if self.formfactorcombobox == 'SphericalSLDModel': 
     485                self.multi_factor += 1 
    478486            self.formfactorcombobox = formfactor 
    479487            self.structurecombobox = structurefactor 
    480488            self.parameters = [] 
    481489            self.parameters = self.param_remap_from_sasmodels_convert(params) 
    482             if str_params: 
    483                 self.str_parameters = \ 
    484                     self.param_remap_from_sasmodels_convert(str_params) 
    485490 
    486491    def _repr_helper(self, list, rep): 
Note: See TracChangeset for help on using the changeset viewer.