Example #1
0
 def dynarepp_to_pml(self,template_paramdic=None,fpath=None,focli=None):
     if fpath == None:
         if template_paramdic == None:
             return dynarepp_to_pml.translate(template_paramdic=self.template_paramdic,focli=focli)
         else:
             return dynarepp_to_pml.translate(template_paramdic=template_paramdic,focli=focli)
     else:
         if template_paramdic == None:
             dynarepp_to_pml.translate(template_paramdic=self.template_paramdic,fpath=fpath,focli=focli)
         else:
             dynarepp_to_pml.translate(template_paramdic=template_paramdic,fpath=fpath,focli=focli)
Example #2
0
 def dynarepp_to_pml(self, template_paramdic=None, fpath=None, focli=None):
     if fpath == None:
         if template_paramdic == None:
             return dynarepp_to_pml.translate(
                 template_paramdic=self.template_paramdic, focli=focli)
         else:
             return dynarepp_to_pml.translate(
                 template_paramdic=template_paramdic, focli=focli)
     else:
         if template_paramdic == None:
             dynarepp_to_pml.translate(
                 template_paramdic=self.template_paramdic,
                 fpath=fpath,
                 focli=focli)
         else:
             dynarepp_to_pml.translate(template_paramdic=template_paramdic,
                                       fpath=fpath,
                                       focli=focli)
Example #3
0
    def init1(self,no_wrap=False):
        '''
        The init1 method. Model population proceeds from the __init__function here. In particular the data gets read in
        (not implemented at the moment) and the model parsing begins.
        
        .. note::
           The other.vardic gets created and the manual as well as
           the numerical steady state sections gets parsed and attached to the DSGE model instance. So the most import fields created
           here using function populate_model_stage_one() are:
           
             * other.vardic - variable names dictionary with transform and filtering info
             * other.mod_name - short name of the DSGE model from mod file
             * other.mod_desc - longer model description from mod file
             * other.paramdic - dic of defined parameters with their numerical values
             * other.manss_sys - list of equations from the closed form steady state section
             * other.ssys_list - list of equations from the numerical steady state section
           
           Also the updaters and updaters_queued branches are opened here and the other.vardic gets wrapped for dynamic updating
           behaviour.
        
        :param other:     The DSGE model instance itother.
        :type other:      dsge_inst
        
        '''
        other = self._other
        initlev = other._initlev
        ncpus = other._ncpus
        mk_hessian = other._mk_hessian
        mesg = other._mesg
        # Attach the data from database
        if other.dbase != None:
            other.getdata(dbase=other.dbase)        
        if mesg: print "INIT: Instantiating DSGE model with INITLEV="+str(initlev)+" and NCPUS="+str(ncpus)+"..."
        if mesg: print "INIT: Attaching model properties to DSGE model instance..."

        # Create None tester regular expression
        #        _nreg = '^\s*None\s*$'
        #        nreg = re.compile(_nreg)
        
        if mesg: print "INIT: Parsing model file into DSGE model instance..."
        txtpars = parse_mod(other.modfile)
        other.txtpars = txtpars  # do we need txtpars attached for anything else?
        secs = txtpars.secs # do we need txtpars attached for anything else?
        if mesg: print "INIT: Extraction of info into DSGE model instance Stage [1]..."
        # Initial population method of model, does NOT need steady states
        if txtpars.fmt == 'pymaclab':
            other = populate_model_stage_one(other, secs)
        elif txtpars.fmt == 'dynarepp':
            pml_modfile = dynarepp_to_pml.translate(secs=secs)

        if not no_wrap:
            # Open updaters path
            other.updaters = Updaters()        
            # Open the updaters_queued path
            other.updaters_queued = Updaters_Queued()
            # Add the empty queue
            other.updaters_queued.queue = queue
    
            # Wrap the vardic
            other.updaters.vardic = dicwrap_deep(other,'self.vardic',initlev)
            other.updaters_queued.vardic = dicwrap_deep_queued(other,'self.vardic',initlev)