Example #1
0
    self.bin_opts = opts

  def process(self):
    self.fout = self.get_tmp_file(suffix = ".mrc")
    self.flog = self.get_tmp_file(suffix = ".log")

    ## ndsafir is a bit weird about where it prints log.  The actual log
    ## is being printed to stderr.  Then, it appears it has a bug which
    ## causes the sampling value to be printed to stdout during the first
    ## iteration. We throw this away by redirecting stdout to devnull.
    with open(os.devnull, "w") as null:
      super(ndsafir, self).process(
        [self.bin, self.fin.name, self.fout.name ] + self.bin_opts,
        stderr  = self.flog,
        stdout  = null,
      )

  def send_child(self):
    self.basename = os.path.splitext(self.parent.getName())[0]
    self.child_name = self.basename + "_DN.mrc"

    super(ndsafir, self).send_child()

if __name__ == "__main__":
  chain = omero_scripts_processing.chain([
    ndsafir(bin_path = "/usr/local/priism/bin/ndsafir_priism")
  ])
  chain.launch()

Example #2
0
        self.code = self.protect_exit(self.code)

    def run_matlab(self):
        ## 10min should be enough
        super(fastSPDM, self).run_matlab(timeout=10)

    def send_child(self):
        child_sufix = "_imstres_pz_%i.tif" % self.options["pxsz"]
        fout_name = os.path.splitext(self.fin.name)[0] + child_sufix
        ## FIXME we should not have to actually open a file
        self.fout = open(fout_name, "r")

        self.basename = os.path.splitext(self.parent.getName())[0]
        self.child_name = self.basename + child_sufix

        super(fastSPDM, self).send_child()

        ## Because this was not created as temporary file...
        self.fout.close()
        try:
            os.unlink(fout_name)
        except OSError as e:
            if e.errno != errno.ENOENT:  # No such file or directory
                raise


if __name__ == "__main__":
    chain = omero_scripts_processing.chain([fastSPDM()])
    chain.launch()