示例#1
0
  private void writeResultsXml(GtaResult resultsObject) throws IOException {

    String newAnResFileName =
        FileUtil.findFreeFileName(
            resultsfolder,
            resultsfolder.getName() + "_" + modelReference.getFilename() + "_results",
            "xml");
    FileObject newAnResFile = resultsfolder.createData(newAnResFileName, "xml");
    resultsObject.setSummary(new Summary());
    resultsObject.getSummary().setFitModelCall(fitModelCall);
    // TODO resolve problem with multiple modelcalls
    resultsObject.getSummary().setInitModelCall(modelCalls.get(0));

    for (int i = 0; i < relationsList.size(); i++) {
      resultsObject.getDatasetRelations().add(new DatasetRelation());
      resultsObject
          .getDatasetRelations()
          .get(i)
          .setTo(String.valueOf((int) floor(relationsList.get(i)[0])));
      resultsObject
          .getDatasetRelations()
          .get(i)
          .setFrom(String.valueOf((int) floor(relationsList.get(i)[1])));
      // TODO do this in a different way
      // resultsObject.getDatasetRelations().get(i).getValues().add(relationsList.get(i)[2]);
      String cmd =
          timpcontroller.NAME_OF_RESULT_OBJECT
              + "$currTheta[["
              + (int) floor(relationsList.get(i)[0])
              + "]]@drel";
      resultsObject.getDatasetRelations().get(i).getValues().add(timpcontroller.getDouble(cmd));
    }

    createAnalysisResultsFile(resultsObject, FileUtil.toFile(newAnResFile));
  }
示例#2
0
  private void createAnalysisResultsFile(GtaResult resultsObject, File file) {
    try {
      javax.xml.bind.JAXBContext jaxbCtx =
          javax.xml.bind.JAXBContext.newInstance(resultsObject.getClass().getPackage().getName());
      javax.xml.bind.Marshaller marshaller = jaxbCtx.createMarshaller();
      marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_ENCODING, "UTF-8"); // NOI18N
      marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
      marshaller.marshal(resultsObject, file);

    } catch (javax.xml.bind.JAXBException ex) {
      // XXXTODO Handle exception
      java.util.logging.Logger.getLogger("global")
          .log(java.util.logging.Level.SEVERE, null, ex); // NOI18N
    }
  }
示例#3
0
  private void writeResults(
      TimpResultDataset[] results, GtaModelReference modelReference, String[] nlsprogressResult) {
    Tgm model = getModel(modelReference);
    GtaResult newResultsObject = new GtaResult();
    String freeResultsFilename =
        FileUtil.findFreeFileName(resultsfolder, resultsfolder.getName(), "summary");
    try {
      writeSummary(resultsfolder, freeResultsFilename);
    } catch (IOException ex) {
      Exceptions.printStackTrace(ex);
    }

    if (nlsprogressResult != null) {
      for (int i = 0; i < nlsprogressResult.length; i++) {
        NlsProgress progress = new NlsProgress();
        progress.setRss(nlsprogressResult[i]);
        newResultsObject.getNlsprogress().add(progress);
      }
    }

    for (int i = 0; i < results.length; i++) {
      TimpResultDataset timpResultDataset = results[i];
      timpResultDataset.setType(datasets[i].getType());

      newResultsObject.getDatasets().add(new Dataset());
      newResultsObject.getDatasets().get(i).setDatasetFile(new OutputFile());
      newResultsObject
          .getDatasets()
          .get(i)
          .getDatasetFile()
          .setFilename(datasetContainer.getDatasets().get(i).getFilename());
      newResultsObject
          .getDatasets()
          .get(i)
          .getDatasetFile()
          .setPath(datasetContainer.getDatasets().get(i).getPath());
      newResultsObject.getDatasets().get(i).getDatasetFile().setFiletype(datasets[i].getType());
      newResultsObject.getDatasets().get(i).setId(String.valueOf(i + 1));

      if (model.getDat().getIrfparPanel().getLamda() != null) {
        timpResultDataset.setLamdac(model.getDat().getIrfparPanel().getLamda());
      }

      if (datasets[i].getType().equalsIgnoreCase("flim")) {
        timpResultDataset.setOrheigh(datasets[i].getOriginalHeight());
        timpResultDataset.setOrwidth(datasets[i].getOriginalWidth());
        timpResultDataset.setIntenceIm(datasets[i].getIntenceIm().clone());
        timpResultDataset.setMaxInt(datasets[i].getMaxInt());
        timpResultDataset.setMinInt(datasets[i].getMinInt());
        timpResultDataset.setX(datasets[i].getX().clone());
        timpResultDataset.setX2(datasets[i].getX2().clone());
      }

      try {
        String freeFilename =
            FileUtil.findFreeFileName(
                resultsfolder,
                resultsfolder.getName() + "_d" + (i + 1) + "_" + timpResultDataset.getDatasetName(),
                "timpres");
        timpResultDataset.setDatasetName(freeFilename);
        writeTo = resultsfolder.createData(freeFilename, "timpres");
        ObjectOutputStream stream = new ObjectOutputStream(writeTo.getOutputStream());
        stream.writeObject(timpResultDataset);
        stream.close();

        newResultsObject.getDatasets().get(i).setResultFile(new OutputFile());
        newResultsObject.getDatasets().get(i).getResultFile().setFilename(freeFilename);
        newResultsObject
            .getDatasets()
            .get(i)
            .getResultFile()
            .setPath(FileUtil.getRelativePath(project.getProjectDirectory(), resultsfolder));

      } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
      }
    }
    try {
      writeResultsXml(newResultsObject);
    } catch (IOException ex) {
      Exceptions.printStackTrace(ex);
    }
  }