@@ -89,6 +89,8 @@ def create_build_parser(subprasers, prog, help):
8989 help = """Speciation model (birth-death or Yule)""" )
9090 parser .add_argument ('--grid' , metavar = 'I' , required = False , type = int , help = """Number of grid points in skygrid""" )
9191 parser .add_argument ('--cutoff' , metavar = 'G' , required = False , type = float , help = """a cutoff for skygrid""" )
92+ parser .add_argument ('--non_centered' , action = "store_true" ,
93+ help = """Use non centered parameterization for population size parameters (skygrid only)""" )
9294 parser .add_argument ('--time_aware' , action = "store_true" , help = """Use time-aware GMRF (skyride only)""" )
9395 parser .add_argument ('--compile' , action = "store_true" , help = """Compile Stan script""" )
9496 parser .add_argument ('--rescaling' , action = "store_true" , help = """Use rescaling in DNA tree likelihood calculation""" )
@@ -99,7 +101,7 @@ def create_build_parser(subprasers, prog, help):
99101
100102def create_compile_parser (subprasers , prog , help ):
101103 parser = subprasers .add_parser (prog , help = help )
102- parser .add_argument ('-s' , '--script' , required = True , type = argparse . FileType ( 'r' ), help = """Stan script file""" )
104+ parser .add_argument ('-s' , '--script' , required = True , help = """Stan script file""" )
103105 return parser
104106
105107
@@ -164,15 +166,19 @@ def build(arg):
164166 fp .write (script )
165167
166168 if arg .compile :
167- compile_script (arg .script . name )
169+ compile_script_func (arg .script )
168170
169171
170172def compile_script (arg ):
171- binary = arg .script .name .replace ('.stan' , '.pkl' )
173+ compile_script_func (arg .script )
174+
175+
176+ def compile_script_func (script_name ):
177+ binary = script_name .replace ('.stan' , '.pkl' )
172178 # arg.script does not end with .stan
173- if binary == arg . script . name :
174- binary = arg . script . name + '.pkl'
175- sm = pystan .StanModel (file = arg . script . name )
179+ if binary == script_name :
180+ binary = script_name + '.pkl'
181+ sm = pystan .StanModel (file = script_name )
176182 with open (binary , 'wb' ) as f :
177183 pickle .dump (sm , f )
178184
0 commit comments