Ignore:
Timestamp:
Jul 9, 2012 6:39:37 AM (12 years ago)
Author:
Kieran Campbell <kieranrcampbell@…>
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:
a269378
Parents:
9696a10b
Message:

Added mechanism for model categorization and DAB Model python → c++

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/python_wrapper/WrapperGenerator.py

    r0a9686d rfa6db8b  
    9090        ## parameters with orientation 
    9191        self.orientation_params =[] 
     92        # Model category 
     93        self.category = None 
    9294        ## output directory for wrappers 
    9395        self.output_dir = output_dir 
     
    216218                    raise ValueError, "Could not parse file %s" % self.file 
    217219                 
     220            key = "[CATEGORY]" 
     221            if line.count(key)>0: 
     222                try: 
     223                    index = line.index(key) 
     224                    toks = line[index:].split("=") 
     225                    self.category = toks[1].lstrip().rstrip() 
     226 
     227                except: 
     228                    raise ValueError, "Could not parse file %s" % self.file 
     229 
     230 
     231 
    218232            # Catch struct name 
    219233            # C++ class definition 
     
    471485            newline = self.replaceToken(newline,  
    472486                               "[ORIENTATION_PARAMS]", oriented_str) 
    473             
     487             
     488            if self.category: 
     489                newline = self.replaceToken(newline,"[CATEGORY]" 
     490                                            ,'"' + self.category + '"') 
     491            else: 
     492                newline = self.replaceToken(newline,"[CATEGORY]", 
     493                                            "None") 
     494             
     495 
     496 
    474497            # Write new line to the wrapper .c file 
    475498            file.write(newline+'\n') 
Note: See TracChangeset for help on using the changeset viewer.