@(@\newcommand{\B}[1]{ {\bf #1} }
\newcommand{\R}[1]{ {\rm #1} }
\newcommand{\W}[1]{ \; #1 \; }@)@
This is dismod_at-20221105 documentation: Here is a link to its
current documentation
.
depend Command: Example and Test
import sys
import os
import copy
# ---------------------------------------------------------------------------# check execution is from distribution directory
example = 'example/get_started/depend_command.py'
if sys.argv[0] != example orlen(sys.argv) != 1 :
usage = 'python3 ' + example + '\n'
usage += 'where python3 is the python 3 program on your system\n'
usage += 'and working directory is the dismod_at distribution directory\n'
sys.exit(usage)
## import dismod_at
local_dir = os.getcwd() + '/python'
if( os.path.isdir( local_dir + '/dismod_at' ) ) :
sys.path.insert(0, local_dir)
import dismod_at
## import get_started_db example
sys.path.append( os.getcwd() + '/example/get_started' )
import get_started_db
## change into the build/example/get_started directoryifnot os.path.exists('build/example/get_started') :
os.makedirs('build/example/get_started')
os.chdir('build/example/get_started')
# ---------------------------------------------------------------------------# create get_started.db
get_started_db.get_started_db()
# -----------------------------------------------------------------------
program = '../../devel/dismod_at'
file_name = 'get_started.db'
dismod_at.system_command_prc( [program, file_name, 'init'] )
dismod_at.system_command_prc( [program, file_name, 'depend'] )
# -----------------------------------------------------------------------# connect to database
new = False
connection = dismod_at.create_connection(file_name, new)
# -----------------------------------------------------------------------# get variable and depend_var tables
var_table = dismod_at.get_table_dict(connection, 'var')
depend_var_table = dismod_at.get_table_dict(connection, 'depend_var')
#for var_id inrange( len(var_table) ) :
var_row = var_table[var_id]
depend_var_row = depend_var_table[var_id]
# data depends on both variablesassert depend_var_row[ 'data_depend' ] == 1
# uniform prior does not depend on argument valueassert depend_var_row[ 'prior_depend' ] == 0
# -----------------------------------------------------------------------print('depend_command: OK')