Ejemplo n.º 1
0
        /*
        public TimeSeries createTimeSeries(string name)
        {
            string wtf = this.currentSimulationName;
            Simulation currentSimulation = getCurrentSimulation();
            TimeSeries ts = new TimeSeries(name, "", currentSimulation.Parameters.StepTime);
            currentSimulation.Parameters.TimeSeries.Add(ts);
            return ts;
        }
         */
        public bool validateTimeSeries(TimeSeries ts)
        {
            Experiment currentExperiment = null;
            Simulation currentSimulation = null;
            List<Model.SBML.Model> models = new List<MuCell.Model.SBML.Model>();

            foreach (Experiment e in openExperiments)
            {
                if (e.Id == currentExperimentID)
                {
                    currentExperiment = e;
                    System.Console.WriteLine(currentExperiment.Id);
                    break;
                }
            }

            if (currentExperiment != null)
            {
                foreach (Simulation s in currentExperiment.getSimulations())
                {
            //<<<<<<< .mine
            //                    currentSimulation = s;
            //                    System.Console.WriteLine(currentSimulation.Name);
            //                    break;
            //=======
                    if (s.Name.Equals(currentSimulationName))
                    {
                        currentSimulation = s;
                        break;
                    }
            ////>>>>>>> .r398
                }

                foreach (CellDefinition cd in currentExperiment.getCellDefinitions())
                {
                    models.Add(cd.getModel());
                }
            }

            if (currentSimulation != null)
            {
                try
                {
                    ts.Initialize(models, currentExperiment, currentSimulation);
                    return true;
                }
                catch (Exception e)
                {
                    System.Console.Write(e.ToString());
                    return false;
                }
            }
            return false;
        }
Ejemplo n.º 2
0
        /*
        public TimeSeries createTimeSeries(string name)
        {
            string wtf = this.currentSimulationName;
            Simulation currentSimulation = getCurrentSimulation();
            TimeSeries ts = new TimeSeries(name, "", currentSimulation.Parameters.StepTime);
            currentSimulation.Parameters.TimeSeries.Add(ts);
            return ts;
        }
         */
        public bool validateTimeSeries(TimeSeries ts)
        {
            Experiment currentExperiment = null;
            Simulation currentSimulation = null;
            List<Model.SBML.Model> models = new List<MuCell.Model.SBML.Model>();

            foreach (Experiment e in openExperiments)
            {
                if (e.Id == currentExperimentID)
                {
                    currentExperiment = e;
                    break;
                }
            }

            if (currentExperiment != null)
            {
                foreach (Simulation s in currentExperiment.getSimulations())
                {
                    if (s.Name.Equals(currentSimulationName))
                    {
                        currentSimulation = s;
                        break;
                    }
                }

                foreach (CellDefinition cd in currentExperiment.getCellDefinitions())
                {
                    models.Add(cd.getModel());
                }
            }

            if (currentSimulation != null)
            {
                try
                {
                    ts.Initialize(models, currentExperiment, currentSimulation);
                    return true;
                }
                catch
                {
                    return false;
                }
            }
            return false;
        }