Ignore:
Timestamp:
Sep 17, 2012 7:11:50 PM (12 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:
b71a53b
Parents:
cf7653d3
Message:

merging category branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fittingview/src/sans/perspectives/fitting/models.py

    rf40f743 rdf7a7e3  
    1818# as the base class of plug-in models. 
    1919from sans.models.pluginmodel import Model1DPlugin 
     20from sans.models.BaseComponent import BaseComponent 
    2021    
    2122PLUGIN_DIR = 'plugin_models' 
     23 
     24def get_model_python_path(): 
     25    return os.path.dirname(__file__) 
    2226 
    2327 
     
    261265        """ 
    262266        """ 
     267        self.model_dictionary = {} 
    263268        self.stored_plugins = {} 
    264269        self._getModelList() 
     
    283288         
    284289        """ 
     290 
     291 
    285292        # regular model names only 
    286293        self.model_name_list = [] 
    287294        from sans.models.SphereModel import SphereModel 
     295        self.model_dictionary[SphereModel.__name__] = SphereModel 
    288296        self.shape_list.append(SphereModel) 
    289297        self.multiplication_factor.append(SphereModel) 
     
    291299         
    292300        from sans.models.BinaryHSModel import BinaryHSModel 
     301        self.model_dictionary[BinaryHSModel.__name__] = BinaryHSModel 
    293302        self.shape_list.append(BinaryHSModel) 
    294303        self.model_name_list.append(BinaryHSModel.__name__) 
    295304                         
    296305        from sans.models.FuzzySphereModel import FuzzySphereModel 
     306        self.model_dictionary[FuzzySphereModel.__name__] = FuzzySphereModel 
    297307        self.shape_list.append(FuzzySphereModel) 
    298308        self.multiplication_factor.append(FuzzySphereModel) 
     
    300310                         
    301311        from sans.models.RaspBerryModel import RaspBerryModel 
     312        self.model_dictionary[RaspBerryModel.__name__] = RaspBerryModel 
    302313        self.shape_list.append(RaspBerryModel) 
    303314        self.model_name_list.append(RaspBerryModel.__name__) 
    304315                 
    305316        from sans.models.CoreShellModel import CoreShellModel 
     317        self.model_dictionary[CoreShellModel.__name__] = CoreShellModel 
    306318        self.shape_list.append(CoreShellModel) 
    307319        self.multiplication_factor.append(CoreShellModel) 
     
    309321         
    310322        from sans.models.Core2ndMomentModel import Core2ndMomentModel 
     323        self.model_dictionary[Core2ndMomentModel.__name__] = Core2ndMomentModel 
    311324        self.shape_list.append(Core2ndMomentModel) 
    312325        self.model_name_list.append(Core2ndMomentModel.__name__) 
    313326         
    314327        from sans.models.CoreMultiShellModel import CoreMultiShellModel 
     328        self.model_dictionary[CoreMultiShellModel.__name__] = CoreMultiShellModel 
    315329        self.shape_list.append(CoreMultiShellModel) 
    316330        self.multiplication_factor.append(CoreMultiShellModel) 
     
    318332 
    319333        from sans.models.VesicleModel import VesicleModel 
     334        self.model_dictionary[VesicleModel.__name__] = VesicleModel 
    320335        self.shape_list.append(VesicleModel) 
    321336        self.multiplication_factor.append(VesicleModel) 
     
    323338         
    324339        from sans.models.MultiShellModel import MultiShellModel 
     340        self.model_dictionary[MultiShellModel.__name__] = MultiShellModel 
    325341        self.shape_list.append(MultiShellModel) 
    326342        self.multiplication_factor.append(MultiShellModel) 
     
    328344         
    329345        from sans.models.OnionExpShellModel import OnionExpShellModel 
     346        self.model_dictionary[OnionExpShellModel.__name__] = OnionExpShellModel 
    330347        self.shape_list.append(OnionExpShellModel) 
    331348        self.multiplication_factor.append(OnionExpShellModel) 
     
    333350                          
    334351        from sans.models.SphericalSLDModel import SphericalSLDModel 
     352        self.model_dictionary[SphericalSLDModel.__name__] = SphericalSLDModel 
    335353        self.shape_list.append(SphericalSLDModel) 
    336354        self.multiplication_factor.append(SphericalSLDModel) 
     
    339357         
    340358        from sans.models.LinearPearlsModel import LinearPearlsModel 
     359        self.model_dictionary[LinearPearlsModel.__name__] = LinearPearlsModel 
    341360        self.shape_list.append(LinearPearlsModel) 
    342361        self.model_name_list.append(LinearPearlsModel.__name__) 
    343362           
    344363        from sans.models.PearlNecklaceModel import PearlNecklaceModel 
     364        self.model_dictionary[PearlNecklaceModel.__name__] = PearlNecklaceModel 
    345365        self.shape_list.append(PearlNecklaceModel) 
    346366        self.model_name_list.append(PearlNecklaceModel.__name__) 
     
    348368         
    349369        from sans.models.CylinderModel import CylinderModel 
     370        self.model_dictionary[CylinderModel.__name__] = CylinderModel 
    350371        self.shape_list.append(CylinderModel) 
    351372        self.multiplication_factor.append(CylinderModel) 
     
    353374         
    354375        from sans.models.CoreShellCylinderModel import CoreShellCylinderModel 
     376        self.model_dictionary[CoreShellCylinderModel.__name__] = CoreShellCylinderModel 
    355377        self.shape_list.append(CoreShellCylinderModel) 
    356378        self.multiplication_factor.append(CoreShellCylinderModel) 
     
    358380         
    359381        from sans.models.CoreShellBicelleModel import CoreShellBicelleModel 
     382        self.model_dictionary[CoreShellBicelleModel.__name__] = CoreShellBicelleModel 
    360383        self.shape_list.append(CoreShellBicelleModel) 
    361384        self.multiplication_factor.append(CoreShellBicelleModel) 
     
    363386                 
    364387        from sans.models.HollowCylinderModel import HollowCylinderModel 
     388        self.model_dictionary[HollowCylinderModel.__name__] = HollowCylinderModel 
    365389        self.shape_list.append(HollowCylinderModel) 
    366390        self.multiplication_factor.append(HollowCylinderModel) 
     
    368392               
    369393        from sans.models.FlexibleCylinderModel import FlexibleCylinderModel 
     394        self.model_dictionary[FlexibleCylinderModel.__name__] = FlexibleCylinderModel 
    370395        self.shape_list.append(FlexibleCylinderModel) 
    371396        self.model_name_list.append(FlexibleCylinderModel.__name__) 
    372397 
    373398        from sans.models.FlexCylEllipXModel import FlexCylEllipXModel 
     399        self.model_dictionary[FlexCylEllipXModel.__name__] = FlexCylEllipXModel 
    374400        self.shape_list.append(FlexCylEllipXModel) 
    375401        self.model_name_list.append(FlexCylEllipXModel.__name__) 
    376402         
    377403        from sans.models.StackedDisksModel import StackedDisksModel 
     404        self.model_dictionary[StackedDisksModel.__name__] = StackedDisksModel 
    378405        self.shape_list.append(StackedDisksModel) 
    379406        self.multiplication_factor.append(StackedDisksModel) 
     
    381408         
    382409        from sans.models.ParallelepipedModel import ParallelepipedModel 
     410        self.model_dictionary[ParallelepipedModel.__name__] = ParallelepipedModel 
    383411        self.shape_list.append(ParallelepipedModel) 
    384412        self.multiplication_factor.append(ParallelepipedModel) 
     
    386414         
    387415        from sans.models.CSParallelepipedModel import CSParallelepipedModel 
     416        self.model_dictionary[CSParallelepipedModel.__name__] = CSParallelepipedModel 
    388417        self.shape_list.append(CSParallelepipedModel) 
    389418        self.multiplication_factor.append(CSParallelepipedModel) 
     
    391420         
    392421        from sans.models.EllipticalCylinderModel import EllipticalCylinderModel 
     422        self.model_dictionary[EllipticalCylinderModel.__name__] = EllipticalCylinderModel 
    393423        self.shape_list.append(EllipticalCylinderModel) 
    394424        self.multiplication_factor.append(EllipticalCylinderModel) 
     
    396426         
    397427        from sans.models.BarBellModel import BarBellModel 
     428        self.model_dictionary[BarBellModel.__name__] = BarBellModel 
    398429        self.shape_list.append(BarBellModel) 
    399430        self.model_name_list.append(BarBellModel.__name__) 
     
    402433         
    403434        from sans.models.CappedCylinderModel import CappedCylinderModel 
     435        self.model_dictionary[CappedCylinderModel.__name__] = CappedCylinderModel 
    404436        self.shape_list.append(CappedCylinderModel) 
    405437        self.model_name_list.append(CappedCylinderModel.__name__) 
     
    408440         
    409441        from sans.models.EllipsoidModel import EllipsoidModel 
     442        self.model_dictionary[EllipsoidModel.__name__] = EllipsoidModel 
    410443        self.shape_list.append(EllipsoidModel) 
    411444        self.multiplication_factor.append(EllipsoidModel) 
     
    413446       
    414447        from sans.models.CoreShellEllipsoidModel import CoreShellEllipsoidModel 
     448        self.model_dictionary[CoreShellEllipsoidModel.__name__] = CoreShellEllipsoidModel 
    415449        self.shape_list.append(CoreShellEllipsoidModel) 
    416450        self.multiplication_factor.append(CoreShellEllipsoidModel) 
     
    418452          
    419453        from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel 
     454        self.model_dictionary[TriaxialEllipsoidModel.__name__] = TriaxialEllipsoidModel 
    420455        self.shape_list.append(TriaxialEllipsoidModel) 
    421456        self.multiplication_factor.append(TriaxialEllipsoidModel) 
     
    423458         
    424459        from sans.models.LamellarModel import LamellarModel 
     460        self.model_dictionary[LamellarModel.__name__] = LamellarModel 
    425461        self.shape_list.append(LamellarModel) 
    426462        self.model_name_list.append(LamellarModel.__name__) 
    427463         
    428464        from sans.models.LamellarFFHGModel import LamellarFFHGModel 
     465        self.model_dictionary[LamellarFFHGModel.__name__] = LamellarFFHGModel 
    429466        self.shape_list.append(LamellarFFHGModel) 
    430467        self.model_name_list.append(LamellarFFHGModel.__name__) 
    431468         
    432469        from sans.models.LamellarPSModel import LamellarPSModel 
     470        self.model_dictionary[LamellarPSModel.__name__] = LamellarPSModel 
    433471        self.shape_list.append(LamellarPSModel) 
    434472        self.model_name_list.append(LamellarPSModel.__name__) 
    435473      
    436474        from sans.models.LamellarPSHGModel import LamellarPSHGModel 
     475        self.model_dictionary[LamellarPSHGModel.__name__] = LamellarPSHGModel 
    437476        self.shape_list.append(LamellarPSHGModel) 
    438477        self.model_name_list.append(LamellarPSHGModel.__name__) 
    439478         
    440479        from sans.models.LamellarPCrystalModel import LamellarPCrystalModel 
     480        self.model_dictionary[LamellarPCrystalModel.__name__] = LamellarPCrystalModel 
    441481        self.shape_list.append(LamellarPCrystalModel) 
    442482        self.model_name_list.append(LamellarPCrystalModel.__name__) 
    443483         
    444484        from sans.models.SCCrystalModel import SCCrystalModel 
     485        self.model_dictionary[SCCrystalModel.__name__] = SCCrystalModel 
    445486        self.shape_list.append(SCCrystalModel) 
    446487        self.model_name_list.append(SCCrystalModel.__name__) 
    447488         
    448489        from sans.models.FCCrystalModel import FCCrystalModel 
     490        self.model_dictionary[FCCrystalModel.__name__] = FCCrystalModel 
    449491        self.shape_list.append(FCCrystalModel) 
    450492        self.model_name_list.append(FCCrystalModel.__name__) 
    451493         
    452494        from sans.models.BCCrystalModel import BCCrystalModel 
     495        self.model_dictionary[BCCrystalModel.__name__] = BCCrystalModel 
    453496        self.shape_list.append(BCCrystalModel) 
    454497        self.model_name_list.append(BCCrystalModel.__name__) 
     
    456499        ## Structure factor 
    457500        from sans.models.SquareWellStructure import SquareWellStructure 
     501        self.model_dictionary[SquareWellStructure.__name__] = SquareWellStructure 
    458502        self.struct_list.append(SquareWellStructure) 
    459503        self.model_name_list.append(SquareWellStructure.__name__) 
    460504         
    461505        from sans.models.HardsphereStructure import HardsphereStructure 
     506        self.model_dictionary[HardsphereStructure.__name__] = HardsphereStructure 
    462507        self.struct_list.append(HardsphereStructure) 
    463508        self.model_name_list.append(HardsphereStructure.__name__) 
    464509          
    465510        from sans.models.StickyHSStructure import StickyHSStructure 
     511        self.model_dictionary[StickyHSStructure.__name__] = StickyHSStructure 
    466512        self.struct_list.append(StickyHSStructure) 
    467513        self.model_name_list.append(StickyHSStructure.__name__) 
    468514         
    469515        from sans.models.HayterMSAStructure import HayterMSAStructure 
     516        self.model_dictionary[HayterMSAStructure.__name__] = HayterMSAStructure 
    470517        self.struct_list.append(HayterMSAStructure) 
    471518        self.model_name_list.append(HayterMSAStructure.__name__) 
     
    474521        ##shape-independent models 
    475522        from sans.models.PowerLawAbsModel import PowerLawAbsModel 
     523        self.model_dictionary[PowerLawAbsModel.__name__] = PowerLawAbsModel 
    476524        self.shape_indep_list.append(PowerLawAbsModel) 
    477525        self.model_name_list.append(PowerLawAbsModel.__name__) 
    478526         
    479527        from sans.models.BEPolyelectrolyte import BEPolyelectrolyte 
     528        self.model_dictionary[BEPolyelectrolyte.__name__] = BEPolyelectrolyte 
    480529        self.shape_indep_list.append(BEPolyelectrolyte) 
    481530        self.model_name_list.append(BEPolyelectrolyte.__name__) 
     
    483532         
    484533        from sans.models.BroadPeakModel import BroadPeakModel 
     534        self.model_dictionary[BroadPeakModel.__name__] = BroadPeakModel 
    485535        self.shape_indep_list.append(BroadPeakModel) 
    486536        self.model_name_list.append(BroadPeakModel.__name__) 
    487537         
    488538        from sans.models.CorrLengthModel import CorrLengthModel 
     539        self.model_dictionary[CorrLengthModel.__name__] = CorrLengthModel 
    489540        self.shape_indep_list.append(CorrLengthModel) 
    490541        self.model_name_list.append(CorrLengthModel.__name__) 
    491542         
    492543        from sans.models.DABModel import DABModel 
     544        self.model_dictionary[DABModel.__name__] = DABModel 
    493545        self.shape_indep_list.append(DABModel) 
    494546        self.model_name_list.append(DABModel.__name__) 
    495547         
    496548        from sans.models.DebyeModel import DebyeModel 
     549        self.model_dictionary[DebyeModel.__name__] = DebyeModel 
    497550        self.shape_indep_list.append(DebyeModel) 
    498551        self.model_name_list.append(DebyeModel.__name__) 
    499552         
    500553        from sans.models.FractalModel import FractalModel 
     554        self.model_dictionary[FractalModel.__name__] = FractalModel 
    501555        self.shape_indep_list.append(FractalModel) 
    502556        self.model_name_list.append(FractalModel.__name__) 
    503557         
    504558        from sans.models.FractalCoreShellModel import FractalCoreShellModel 
     559        self.model_dictionary[FractalCoreShellModel.__name__] = FractalCoreShellModel 
    505560        self.shape_indep_list.append(FractalCoreShellModel) 
    506561        self.model_name_list.append(FractalCoreShellModel.__name__) 
    507562         
    508563        from sans.models.GaussLorentzGelModel import GaussLorentzGelModel 
     564        self.model_dictionary[GaussLorentzGelModel.__name__] = GaussLorentzGelModel 
    509565        self.shape_indep_list.append(GaussLorentzGelModel) 
    510566        self.model_name_list.append(GaussLorentzGelModel.__name__) 
    511567                 
    512568        from sans.models.GuinierModel import GuinierModel 
     569        self.model_dictionary[GuinierModel.__name__] = GuinierModel 
    513570        self.shape_indep_list.append(GuinierModel) 
    514571        self.model_name_list.append(GuinierModel.__name__) 
    515572         
    516573        from sans.models.GuinierPorodModel import GuinierPorodModel 
     574        self.model_dictionary[GuinierPorodModel.__name__] = GuinierPorodModel 
    517575        self.shape_indep_list.append(GuinierPorodModel) 
    518576        self.model_name_list.append(GuinierPorodModel.__name__) 
    519577 
    520578        from sans.models.LorentzModel import LorentzModel 
     579        self.model_dictionary[LorentzModel.__name__] = LorentzModel 
    521580        self.shape_indep_list.append(LorentzModel) 
    522581        self.model_name_list.append(LorentzModel.__name__) 
    523582 
    524583        from sans.models.MassFractalModel import MassFractalModel 
     584        self.model_dictionary[MassFractalModel.__name__] = MassFractalModel 
    525585        self.shape_indep_list.append(MassFractalModel) 
    526586        self.model_name_list.append(MassFractalModel.__name__) 
    527587         
    528588        from sans.models.MassSurfaceFractal import MassSurfaceFractal 
     589        self.model_dictionary[MassSurfaceFractal.__name__] = MassSurfaceFractal 
    529590        self.shape_indep_list.append(MassSurfaceFractal) 
    530591        self.model_name_list.append(MassSurfaceFractal.__name__) 
    531592         
    532593        from sans.models.PeakGaussModel import PeakGaussModel 
     594        self.model_dictionary[PeakGaussModel.__name__] = PeakGaussModel 
    533595        self.shape_indep_list.append(PeakGaussModel) 
    534596        self.model_name_list.append(PeakGaussModel.__name__) 
    535597         
    536598        from sans.models.PeakLorentzModel import PeakLorentzModel 
     599        self.model_dictionary[PeakLorentzModel.__name__] = PeakLorentzModel 
    537600        self.shape_indep_list.append(PeakLorentzModel) 
    538601        self.model_name_list.append(PeakLorentzModel.__name__) 
    539602         
    540603        from sans.models.Poly_GaussCoil import Poly_GaussCoil 
     604        self.model_dictionary[Poly_GaussCoil.__name__] = Poly_GaussCoil 
    541605        self.shape_indep_list.append(Poly_GaussCoil) 
    542606        self.model_name_list.append(Poly_GaussCoil.__name__) 
    543607         
    544608        from sans.models.PolymerExclVolume import PolymerExclVolume 
     609        self.model_dictionary[PolymerExclVolume.__name__] = PolymerExclVolume 
    545610        self.shape_indep_list.append(PolymerExclVolume) 
    546611        self.model_name_list.append(PolymerExclVolume.__name__) 
    547612         
    548613        from sans.models.PorodModel import PorodModel 
     614        self.model_dictionary[PorodModel.__name__] = PorodModel 
    549615        self.shape_indep_list.append(PorodModel) 
    550616        self.model_name_list.append(PorodModel.__name__) 
    551617         
    552618        from sans.models.RPA10Model import RPA10Model 
     619        self.model_dictionary[RPA10Model.__name__] = RPA10Model 
    553620        self.shape_indep_list.append(RPA10Model) 
    554621        self.multi_func_list.append(RPA10Model) 
    555622 
    556623        from sans.models.StarPolymer import StarPolymer 
     624        self.model_dictionary[StarPolymer.__name__] = StarPolymer 
    557625        self.shape_indep_list.append(StarPolymer) 
    558626        self.model_name_list.append(StarPolymer.__name__) 
    559627 
    560628        from sans.models.SurfaceFractalModel import SurfaceFractalModel 
     629        self.model_dictionary[SurfaceFractalModel.__name__] = SurfaceFractalModel 
    561630        self.shape_indep_list.append(SurfaceFractalModel) 
    562631        self.model_name_list.append(SurfaceFractalModel.__name__) 
    563632         
    564633        from sans.models.TeubnerStreyModel import TeubnerStreyModel 
     634        self.model_dictionary[TeubnerStreyModel.__name__] = TeubnerStreyModel 
    565635        self.shape_indep_list.append(TeubnerStreyModel) 
    566636        self.model_name_list.append(TeubnerStreyModel.__name__) 
    567637 
    568638        from sans.models.TwoLorentzianModel import TwoLorentzianModel 
     639        self.model_dictionary[TwoLorentzianModel.__name__] = TwoLorentzianModel 
    569640        self.shape_indep_list.append(TwoLorentzianModel) 
    570641        self.model_name_list.append(TwoLorentzianModel.__name__) 
    571642         
    572643        from sans.models.TwoPowerLawModel import TwoPowerLawModel 
     644        self.model_dictionary[TwoPowerLawModel.__name__] = TwoPowerLawModel 
    573645        self.shape_indep_list.append(TwoPowerLawModel) 
    574646        self.model_name_list.append(TwoPowerLawModel.__name__) 
    575647         
    576648        from sans.models.UnifiedPowerRgModel import UnifiedPowerRgModel 
     649        self.model_dictionary[UnifiedPowerRgModel.__name__] = UnifiedPowerRgModel 
    577650        self.shape_indep_list.append(UnifiedPowerRgModel) 
    578651        self.multi_func_list.append(UnifiedPowerRgModel) 
    579652 
    580653        from sans.models.LineModel import LineModel 
     654        self.model_dictionary[LineModel.__name__] = LineModel 
    581655        self.shape_indep_list.append(LineModel) 
    582656        self.model_name_list.append(LineModel.__name__) 
    583657         
    584658        from sans.models.ReflectivityModel import ReflectivityModel 
     659        self.model_dictionary[ReflectivityModel.__name__] = ReflectivityModel 
    585660        self.shape_indep_list.append(ReflectivityModel) 
    586661        self.multi_func_list.append(ReflectivityModel) 
    587662         
    588663        from sans.models.ReflectivityIIModel import ReflectivityIIModel 
     664        self.model_dictionary[ReflectivityIIModel.__name__] = ReflectivityIIModel 
    589665        self.shape_indep_list.append(ReflectivityIIModel) 
    590666        self.multi_func_list.append(ReflectivityIIModel) 
    591667         
    592668        from sans.models.GelFitModel import GelFitModel 
     669        self.model_dictionary[GelFitModel.__name__] = GelFitModel 
    593670        self.shape_indep_list.append(GelFitModel) 
    594671        self.model_name_list.append(GelFitModel.__name__) 
    595672 
     673        #from sans.models.FractalO_Z import FractalO_Z 
     674        #self.model_dictionary[FractalO_Z.__name__] = FractalO_Z 
     675        #self.shape_indep_list.append(FractalO_Z) 
     676        #self.model_name_list.append(FractalO_Z.__name__) 
     677     
    596678        #Looking for plugins 
    597679        self.stored_plugins = self.findModels() 
     
    792874        if int(evt.GetId()) in self.form_factor_dict.keys(): 
    793875            from sans.models.MultiplicationModel import MultiplicationModel 
     876            self.model_dictionary[MultiplicationModel.__name__] = MultiplicationModel 
    794877            model1, model2 = self.form_factor_dict[int(evt.GetId())] 
    795878            model = MultiplicationModel(model1, model2) 
     
    836919        """ 
    837920        return self.model_name_list 
     921 
     922    def get_model_dictionary(self): 
     923        """ 
     924        return dictionary linking model names to objects 
     925        """ 
     926        return self.model_dictionary 
    838927   
    839928         
     
    873962    def get_model_name_list(self): 
    874963        return self.__modelmanager.get_model_name_list() 
     964 
     965    def get_model_dictionary(self): 
     966        return self.__modelmanager.get_model_dictionary() 
Note: See TracChangeset for help on using the changeset viewer.