Ejemplo n.º 1
0
   def write_uber_command(self):
      if show_func_seq: print('=== R ===')  # rcr - not called

      pdir = self.ttobj.cvars.val('proc_dir')
      if os.path.isdir(pdir):
         sstr = self.make_uber_command()
         UTIL.write_text_to_file('%s/.orig.cmd.utt' % pdir, sstr)
Ejemplo n.º 2
0
    def write_script(self, fname=''):
        """write processing script to a file (in the proc_dir)
         - if fname is set, use it, else generate
         - set rvars.file_proc and output_proc
      """

        if not self.script:
            print('** no script to write out')
            return 1
        if fname: name = fname
        else: name = 'script.ttest'

        # store (intended) names for calling tool to execute with
        self.rvars.file_proc = name  # store which file we have written to
        self.rvars.output_proc = 'output.%s' % name  # file for command output

        if self.cvars.verb > 0: print('++ writing script to %s' % name)

        # if requested, make an original copy
        self.LV.retdir = SUBJ.goto_proc_dir(self.cvars.proc_dir)

        if self.cvars.copy_scripts == 'yes':  # make an orig copy
            UTIL.write_text_to_file('.orig.%s' % name, self.script, exe=1)
        rv = UTIL.write_text_to_file(name, self.script, exe=1)

        self.LV.retdir = SUBJ.ret_from_proc_dir(self.LV.retdir)

        return rv
Ejemplo n.º 3
0
    def execute(self):

        if not self.ready_for_action(): return 1

        if self.verb > 1:
            print('-- make %s command with %d set(s) of dsets of length(s): %s' \
                  % (self.command, len(self.dsets),
                     ', '.join([str(len(dlist)) for dlist in self.dsets]) ))

        # might deal with subject IDs and attributes later
        for ind, dlist in enumerate(self.dsets):
            slist = SUBJ.SubjectList(dset_l=dlist, verb=self.verb)
            if slist.status: return 1
            if slist.set_ids_from_dsets(prefix=self.subj_prefix,
                                        suffix=self.subj_suffix,
                                        dpre=self.dent_pre):
                print('** cannot set subject IDs from datasets')
                return 1
            self.slist.append(slist)
            if self.verb > 2: slist.show("slist %d" % ind)

        cmd = None
        if self.command == '3dMEMA':
            cmd = self.get_mema_command()
        elif self.command == '3dttest++':
            cmd = self.get_ttpp_command()
        elif self.command == '3dANOVA2':
            cmd = self.get_anova2_command()
        elif self.command == '3dANOVA3':
            cmd = self.get_anova3_command()
        elif self.command:
            cmd = self.get_generic_command()
        else:
            print('** command not implemented: %s' % self.command)

        # bail on failure, else wrap command
        if cmd == None:
            print('** failed making %s command' % self.command)
            return 1
        cmd = UTIL.add_line_wrappers(cmd)

        # either write to file or print
        if self.write_script:
            if UTIL.write_text_to_file(self.write_script, cmd):
                print("** failed to write command to file '%s'" %
                      self.write_script)
                return 1
            if self.verb > 0:
                print('++ command written to file %s' % self.write_script)
        else:
            print(cmd)
Ejemplo n.º 4
0
3dBrickStat -mask $mask -percentile $bot $step 100 -non-zero \\
            $pre.abs+tlrc > $pre.abs.1D

# have percentile p-values, remove unwanted percentile rankings
1dcat $pre.abs.1D'[1..$(2)]' > $pre.at.1D

# transpose and convert t to p
1deval -a $pre.at.1D\\' -expr "fitt_t2p(a,$dof)" > $pre.p.1D

# convert p to q    (** note: the minimum is not applied, we do not want it)
1deval -a $pre.p.1D -expr "a*$nv/($nv-t)" > $pre.q.1D

# put both together in output file
1dcat $pre.p.1D $pre.q.1D > $output


# ----------------------------------------
# nuke temporary files (comment out to keep)
rm -f $pre.*

"""

ss += static_script

# and write output
U.write_text_to_file(outfile, ss)
try:
    os.chmod(outfile, 0755)
except OSError, e:
    print e
Ejemplo n.º 5
0
 def write_uber_command(self):
     pdir = self.atest.cvars.val('proc_dir')
     if os.path.isdir(pdir):
         sstr = self.make_uber_command()
         UTIL.write_text_to_file('%s/.orig.cmd.uat' % pdir, sstr)