errorTrace: Traceback (most recent call last):
File "C:\VisTrails_SAHM\vistrails\core\modules\vistrails_module.py", line 578, in update
self.compute()
File "C:\VisTrails_SAHM\vistrails\packages\sahm\init.py", line 586, in compute
if orig_lines[1][orig_lines[0].index(orig_covariate)] == 1 and \
IndexError: string index out of range--
You received this message because you are subscribed to the Google Groups "VisTrails SAHM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vistrails-sah...@googlegroups.com.
To post to this group, send email to vistrai...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
def compute(self):
# if the suplied mds has rows, observations then
# pass r code the flag to produce metrics
mdsfname = utils.get_relative_path(self.force_get_input('mdsFile'), self)
workspace = utils.get_relative_path(self.force_get_input('modelWorkspace'), self)
skip_list = ['X', 'Y', 'responseBinary', '', 'Split', 'EvalSplit', 'Weights', 'Split\n', 'EvalSplit\n', 'Weights\n']
mdsfile = open(mdsfname, "r")
lines = mdsfile.readlines()
if len(lines) > 3:
# we have rows R will need to recreate metrics.
self.args = 'pmt=TRUE '
else:
self.args = 'pmt=FALSE '
if len(lines) == 3:
# we're applying this model to a new area
# make sure all the covariates in the original model are in the new csv
# if not tack on the original values.
orig_mds = utils.get_mdsfname(workspace)
orig_mdsfile = open(orig_mds, "r")
orig_lines = orig_mdsfile.readlines()
orig_covariates = [item for item in orig_lines[0][0:].split(",") if item not in skip_list]
orig_use = [item for item in orig_lines[1][0:].split(",") if item in ['0', '1']]
missing_covariates = []
new_covariates = [item for item in lines[0][0:].split(",") if item not in skip_list]
for orig_covariate in orig_covariates:
i = orig_covariates.index(orig_covariate)
if orig_use[i] == "1" and \
new_covariates.count(orig_covariate) == 0:
missing_covariates.append(orig_covariate)
if len(missing_covariates) > 0:
msg = 'One or more of the covariates used in the original model are not specified in the apply model mds file\n'
msg += 'Specfically the following covariates were not found:'
msg += '\n\t'.join(missing_covariates)
raise RuntimeError()
Model.compute(self)