protected override bool StartTest() { bool retValue = true; result = new StartleResult(); try { result.CreateProbes(Probes); startlePressure = STARTLE_PRESSURE.Calculate(); stimulatingPressure = STIMULATING_PRESSURE.Calculate(); result.StartlePressure = startlePressure; result.StimulatingPressure = stimulatingPressure; Log.Status("STIM.PRESSURE = {0:0.0}, STARTLE.PRESSURE: {1:0.0}", stimulatingPressure, startlePressure); state = StartleState.READY; probeNumber = 0; Stimulate(); } catch (Exception e) { Log.Debug(e.Message); } return(retValue); }
private IMatrix ExportResult(Result result) { IMatrix retValue = null; if (result is ConditionedPainResult) { var cpResult = result as ConditionedPainResult; retValue = new Struct("data", new IMatrix[] { new StringArray("type", "ConditionedPainResult"), new StringArray("ID", result.ID), new StringArray("TestName", result.Name), new Matrix("VAS_PDT", result.VAS_PDT), new Matrix("PDT", result.PDT), new Matrix("PTT", result.PTT), new Matrix("PTL", result.PTL), new Matrix("Conditioned", result.Conditioned ? 1 : 0), new Matrix("StimulatingPressure", result.StimulationPressure), new Matrix("ConditioningPressure", result.ConditioningPressure), new Matrix("VAS", result.VAS) }); Console.WriteLine(" -- Conditioned Pain Result [ {0} ]", cpResult.ID); } else if (result is StimulusResponseResult) { var srResult = result as StimulusResponseResult; retValue = new Struct("data", new IMatrix[] { new StringArray("type", "StimulusResponseResult"), new StringArray("ID", result.ID), new StringArray("TestName", result.Name), new Matrix("VAS_PDT", result.VAS_PDT), new Matrix("PDT", result.PDT), new Matrix("PTT", result.PTT), new Matrix("PTL", result.PTL), new Matrix("Conditioned", result.Conditioned ? 1 : 0), new Matrix("StimulatingPressure", result.StimulationPressure), new Matrix("ConditioningPressure", result.ConditioningPressure), new Matrix("VAS", result.VAS) }); Console.WriteLine(" -- SR Result [ {0} ]", srResult.ID); } else if (result is TemporalSummationResult) { var tsResult = result as TemporalSummationResult; retValue = new Struct("data", new IMatrix[] { new StringArray("type", "TemporalSummationResult"), new StringArray("ID", result.ID), new StringArray("TestName", result.Name), new Matrix("VAS_PDT", result.VAS_PDT), new Matrix("PDT", result.PDT), new Matrix("PTT", result.PTT), new Matrix("PTL", result.PTL), new Matrix("Conditioned", result.Conditioned ? 1 : 0), new Matrix("StimulatingPressure", result.StimulationPressure), new Matrix("ConditioningPressure", result.ConditioningPressure), new Matrix("VAS", result.VAS), new Matrix("Responses", tsResult.Responses) }); Console.WriteLine(" -- TS Result [ {0} ]", tsResult.ID); } else if (result is StartleResult) { StartleResult startleResult = result as StartleResult; retValue = new Struct("data", new IMatrix[] { new StringArray("type", "StartleResult"), new StringArray("ID", startleResult.ID), new StringArray("TestName", startleResult.Name), new Matrix("VAS_PDT", startleResult.VAS_PDT), new Matrix("PDT", startleResult.PDT), new Matrix("PTT", startleResult.PTT), new Matrix("PTL", startleResult.PTL), new Matrix("Conditioned", startleResult.Conditioned ? 1 : 0), new Matrix("StimulatingPressure", startleResult.StimulationPressure), new Matrix("ConditioningPressure", startleResult.ConditioningPressure), new Matrix("StartlePressure", startleResult.StartlePressure), new Matrix("VAS", startleResult.VAS), new Cell("probes", (from p in startleResult.Probes select new Struct("probe", new IMatrix[] { new Matrix("startle", p.IsStartle ? 1 : 0), new Matrix("VAS", p.VAS) }) ).ToArray()) }); Console.WriteLine(" -- Startle Result [ {0} ]", startleResult.ID); } else if (result is StaticTemporalSummationResult) { var tsResult = result as StaticTemporalSummationResult; retValue = new Struct("data", new IMatrix[] { new StringArray("type", "StartleResult"), new StringArray("ID", result.ID), new StringArray("TestName", result.Name), new Matrix("VAS_PDT", result.VAS_PDT), new Matrix("PDT", result.PDT), new Matrix("PTT", result.PTT), new Matrix("PTL", result.PTL), new Matrix("Conditioned", result.Conditioned ? 1 : 0), new Matrix("StimulatingPressure", result.StimulationPressure), new Matrix("ConditioningPressure", result.ConditioningPressure), new Matrix("VAS", result.VAS), new Matrix("MaximalVAS", tsResult.MaximalVAS), new Matrix("MaximalTime", tsResult.MaximalTime), new Matrix("AverageVAS", tsResult.AverageVASStimulation), new Matrix("AbortTime", tsResult.AbortTime), new Matrix("VASTail", tsResult.VASEndOfStimulation) }); Console.WriteLine(" -- Static TS Result [ {0} ]", tsResult.ID); } else { retValue = new Struct("data", new IMatrix[] { new StringArray("type", "NULL") }); Console.WriteLine(" -- Null Result [ {0} ]", result.ID); } return(retValue); }