Beispiel #1
0
            static HH_MM GetHHMMFromTime(TimeEstimation time)
            {
                int hour   = (int)Math.Floor(time.Length);
                int minute = (int)Math.Floor((time.Length - hour) * 60);

                return(new HH_MM {
                    Hour = hour,
                    Minute = minute
                });
            }
Beispiel #2
0
            static HH_MM GetHHMMFromMs(TimeEstimation time)
            {
                int hour   = (int)Math.Floor(time.Length / MsInHour);
                int minute = (int)Math.Floor((time.Length - (hour * MsInHour)) / MsInMinute);

                return(new HH_MM {
                    Hour = hour,
                    Minute = minute
                });
            }
Beispiel #3
0
            private void CompileWholeDay(PeriodHolder holder, List <double> estimations)
            {
                TimeEstimation estimation = EstimateDayLengthFromWholeDay();

                if (estimation.Reliable)
                {
                    estimations.Add(estimation.Length);
                }
                holder.Reset(holder.LastTransition);
            }
Beispiel #4
0
            private void CompileDaytime(PeriodHolder holder, List <double> estimations)
            {
                TimeEstimation estimation = EstimateDayLengthFromDaytime();

                if (estimation.Reliable)
                {
                    estimations.Add(estimation.Length);
                }
                holder.Reset();
            }
Beispiel #5
0
 private TimeEstimation EstimateTimeOfDay(TimeEstimation dayLength)
 {
     if (_lastRelevantTransition != null && dayLength.Reliable)
     {
         double currentTime = _lastRelevantTransition.EstimatedTime +
                              (24 * (_timestamp - _lastRelevantTransition.Timestamp) / dayLength.Length);
         return(new TimeEstimation {
             Length = Mod(currentTime, 24),
             Reliable = true
         });
     }
     else if (_lastRelevantTransition != null &&
              (_lastState is SolarStateChasing || _lastState is SolarStateIdlingDay))
     {
         return(new TimeEstimation {
             Length = _lastRelevantTransition.EstimatedTime,
             Reliable = false
         });
     }
     else if (_lastState is SolarStateIdlingDusk)
     {
         return(new TimeEstimation {
             Length = 20,
             Reliable = false
         });
     }
     else if (_lastState is SolarStateReseting)
     {
         return(new TimeEstimation {
             Length = 22,
             Reliable = false
         });
     }
     else if (_lastState is SolarStateIdlingNight)
     {
         return(new TimeEstimation {
             Length = 0,
             Reliable = false
         });
     }
     else if (_lastState is SolarStateIdlingDawn)
     {
         return(new TimeEstimation {
             Length = 4,
             Reliable = false
         });
     }
     else
     {
         return(new TimeEstimation {
             Length = 12,
             Reliable = false
         });
     }
 }
Beispiel #6
0
            public TimeStruct GetTime()
            {
                TimeEstimation dayLength = EstimateDayLength();

                return(new TimeStruct {
                    Time = EstimateTimeOfDay(dayLength),
                    DayLength = dayLength,
                    DuskLength = EstimateLength(_historicalData.DuskLengthEstimations, dayLength.Length / 8),
                    NightLength = EstimateLength(_historicalData.NightLengthEstimations, dayLength.Length / 4),
                    DawnLength = EstimateLength(_historicalData.DawnLengthEstimations, dayLength.Length / 8)
                });
            }
        private void InitStepsInfo()
        {
            var stepsDef = SettingsManager.Instance.Protocol.StepsDefinition;

            timeEstimation = new TimeEstimation();
            stepsDefWithProgressInfo.Clear();
            foreach (var stepDef in stepsDef)
            {
                var stepDefEx = new StepDefinitionWithProgressInfo(stepDef);
                stepsDefWithProgressInfo.Add(stepDefEx);
            }
            timeInfo.DataContext   = timeEstimation;
            lvProtocol.ItemsSource = stepsDefWithProgressInfo;
        }
Beispiel #8
0
            private TimeEstimation EstimateDayLength()
            {
                TimeEstimation historicalWholeDay, wholeDay, historicalDayTime, dayTime;

                if (_historicalData.WholeDayLengthEstimations.Count() > 0)
                {
                    historicalWholeDay = new TimeEstimation {
                        Length   = _historicalData.WholeDayLengthEstimations.Average(),
                        Reliable = true
                    };
                }
                else
                {
                    historicalWholeDay = new TimeEstimation();
                }
                wholeDay = EstimateDayLengthFromWholeDay();
                if (_historicalData.DayLengthEstimations.Count() > 0)
                {
                    historicalDayTime = new TimeEstimation {
                        Length   = _historicalData.DayLengthEstimations.Average(),
                        Reliable = true
                    };
                }
                else
                {
                    historicalDayTime = new TimeEstimation();
                }
                dayTime = EstimateDayLengthFromDaytime();
                if (historicalWholeDay.Length > 0)
                {
                    return(historicalWholeDay);
                }
                else if (wholeDay.Length > 0)
                {
                    return(wholeDay);
                }
                else if (historicalDayTime.Length > 0)
                {
                    return(historicalDayTime);
                }
                else if (dayTime.Length > 0)
                {
                    return(dayTime);
                }
                return(new TimeEstimation()
                {
                    Length = 1000000
                });
            }
Beispiel #9
0
                private void TestEstimateTime()
                {
                    DayTracker dayTracker = new DayTracker();

                    AssertEqual(dayTracker.EstimateTimeOfDay(new TimeEstimation()).Length, 12, "Wrong default time estimation");
                    dayTracker._lastRelevantTransition = new Transition {
                        Type          = TransitionTypeEnum.IdlingToChasing,
                        Timestamp     = 15000,
                        EstimatedTime = 15
                    };
                    dayTracker._lastState = new SolarStateChasing();
                    AssertEqual(dayTracker.EstimateTimeOfDay(new TimeEstimation()).Length, 15, "Wrong time esitmation during the day");
                    dayTracker._timestamp = 18000;
                    TimeEstimation time = new TimeEstimation {
                        Length   = 24000,
                        Reliable = true
                    };

                    AssertEqual(dayTracker.EstimateTimeOfDay(time).Length, 18, "Wrong historical estimation");
                    dayTracker._timestamp = 25000;
                    AssertEqual(dayTracker.EstimateTimeOfDay(time).Length, 1, "Wrong historical estimation after midnight");
                }
Beispiel #10
0
        private void buttonEjecutar_Click(object sender, EventArgs e)
        {
            #region Se debe seleccionar una prueba y un paciente
            if (comboBoxPrueba.SelectedItem == null)
            {
                var r = new Resp(Resources.MSG_Select_Test);
                r.ShowDialog(this);
                return;
            }
            if (comboBoxPaciente.SelectedItem == null)
            {
                var r = new Resp(Resources.MSG_Select_Patient);
                r.ShowDialog(this);
                return;
            }
            #endregion

            if (ap.Paciente != null)
            {
                if (this.comboBoxPrueba.Text == Resources.ComboValue_MF)
                {
                    var f = new MF_Form(this.ap.Configuracion.Imagenes_MF,
                                        ap.Configuracion.Presentacion_MF,
                                        ap.Configuracion.Muestra_MF,
                                        ap.Configuracion.Descanso_MF,
                                        this.ap.Paciente.Codigo);
                    f.ShowDialog(this);
                    this.ap.Adicionar_Resultado(f.Resultado);
                    //if (this.checkBoxMostrarResultado.Checked)
                    //{
                    //    var r = new Reporte(ap.Paciente, f.Resultado);
                    //    r.ShowDialog(this);
                    //}
                    return;
                }
                if (this.comboBoxPrueba.Text == Resources.ComboValue_PVA ||
                    this.comboBoxPrueba.Text == Resources.ComboValue_PVA2)
                {
                    var tipo = this.comboBoxPrueba.Text == Resources.ComboValue_PVA
                                   ? PVA_Type.PVA_1
                                   : PVA_Type.PVA_2;

                    var f = new PVA_Form(tipo, ap.Paciente.Codigo,
                                         ap.Configuracion.Presentacion_PVA,
                                         ap.Configuracion.Muestra_PVA,
                                         ap.Configuracion.Descanso_PVA,
                                         ap.Configuracion.Colores_PVA,
                                         ap.Configuracion.Imagenes_PVA);
                    f.ShowDialog(this);
                    this.ap.Adicionar_Resultado(f.Resultado);
                    //if (this.checkBoxMostrarResultado.Checked)
                    //{
                    //    var r = new Reporte(ap.Paciente, f.Resultado);
                    //    r.ShowDialog(this);
                    //}
                    return;
                }
                if (this.comboBoxPrueba.Text == Resources.ComboValue_AM)
                {
                    var n = new NumScreen(ap.Configuracion.Exp_Digito_AM,
                                          ap.Paciente.Codigo,
                                          ap.Configuracion.Intervalo_AM,
                                          ap.Configuracion.Reaccion_AM);
                    n.ShowDialog(this);
                    this.ap.Adicionar_Resultado(n.Resultado);
                    //if (this.checkBoxMostrarResultado.Checked)
                    //{
                    //    var r = new Reporte(ap.Paciente, n.Resultado);
                    //    r.ShowDialog(this);
                    //}
                    return;
                }
                if (this.comboBoxPrueba.Text == Resources.ComboValue_ASS_Colores)
                {
                    int tecla_reaccion = this.ap.Configuracion.TeclaTarget_CASS_L == Resources.KeyName_Enter ? 13 : 32;
                    var f2             = new PsicoTests.Yovany.ASS.Colores.FormASSL(this.ap.Paciente.Codigo,
                                                                                    this.ap.Configuracion.Letras_CASS_L[this.ap.Configuracion.Letra_Diana_CASS_L].ToString(),
                                                                                    this.ap.Configuracion.Color_LetraDiana_CASS_L,
                                                                                    this.ap.Configuracion.Bloques_CASS_L,
                                                                                    this.ap.Configuracion.EstimulosBloques_CASS_L,
                                                                                    this.ap.Configuracion.TiempoVisualizacion_CASS_L,
                                                                                    this.ap.Configuracion.TiempoOcultamiento_CASS_L,
                                                                                    tecla_reaccion);
                    f2.ShowDialog(this);
                    this.ap.Adicionar_Resultado(f2.Resultado);
                    //if (this.checkBoxMostrarResultado.Checked)
                    //{
                    //    var r = new Reporte(ap.Paciente, f2.Resultado);
                    //    r.ShowDialog(this);
                    //}
                    return;
                }
                if (this.comboBoxPrueba.Text == Resources.ComboValue_TRC)
                {
                    int tecla_reaccion1 = ap.Configuracion.Tecla1_TRC == Resources.KeyName_Enter ? 13 : 32;
                    int tecla_reaccion2 = ap.Configuracion.Tecla2_TRC == Resources.KeyName_Enter ? 13 : 32;
                    var f = new FormTR(this.ap.Paciente.Codigo,
                                       ap.Configuracion.Color1_TRC,
                                       ap.Configuracion.Color2_TRC,
                                       ap.Configuracion.MaxEstimulos_TRC,
                                       ap.Configuracion.TiempoVisualizacion_TRC,
                                       ap.Configuracion.TiempoReaccion_TRC,
                                       tecla_reaccion1,
                                       tecla_reaccion2,
                                       ap.Configuracion.Figura_TRC);
                    f.ShowDialog(this);
                    this.ap.Adicionar_Resultado(f.Resultado);
                    //if (this.checkBoxMostrarResultado.Checked)
                    //{
                    //    var r = new Reporte(ap.Paciente, f.Resultado);
                    //    r.ShowDialog(this);
                    //}
                    return;
                }
                if (this.comboBoxPrueba.Text == Resources.ComboValue_TRS)
                {
                    int tecla_reaccion = ap.Configuracion.Tecla1_TRS == Resources.KeyName_Enter ? 13 : 32;
                    var f = new FormTRS(this.ap.Paciente.Codigo,
                                        tecla_reaccion,
                                        ap.Configuracion.Color1_TRS,
                                        ap.Configuracion.MaxEstimulos_TRS,
                                        ap.Configuracion.TiempoVisualizacion_TRS,
                                        ap.Configuracion.TiempoReaccion_TRS,
                                        ap.Configuracion.Figura_TRS);
                    f.ShowDialog(this);
                    this.ap.Adicionar_Resultado(f.Resultado);
                    //if (this.checkBoxMostrarResultado.Checked)
                    //{
                    //    var r = new Reporte(ap.Paciente, f.Resultado);
                    //    r.ShowDialog(this);
                    //}
                    return;
                }
                if (this.comboBoxPrueba.Text == Resources.ComboValue_RL)
                {
                    var r = new Recuerdo(this.ap.Paciente.Codigo,
                                         ap.Configuracion.TiempoVisualizacion1_RL,
                                         ap.Configuracion.TiempoOcultamiento1_RL,
                                         ap.Configuracion.TiempoVisualizacion15_RL,
                                         ap.Configuracion.TiempoVisualizacion2_RL,
                                         ap.Configuracion.TiempoOcultamiento2_RL);
                    r.ShowDialog(this);
                    this.ap.Adicionar_Resultado(r.Resultado);
                    //if (this.checkBoxMostrarResultado.Checked)
                    //{
                    //    var rep = new Reporte(ap.Paciente, r.Resultado);
                    //    rep.ShowDialog(this);
                    //}
                    return;
                }
                if (this.comboBoxPrueba.Text == Resources.Combovalue_EM)
                {
                    var t = new TimeEstimation(this.ap.Paciente.Codigo,
                                               ap.Configuracion.MaxEstimulos_ET,
                                               ap.Configuracion.IntervaloSalida_ET,
                                               ap.Configuracion.AnchoEstimulo_ET,
                                               ap.Configuracion.AltoEstimulo_ET,
                                               ap.Configuracion.ZonaOpaca_ET,
                                               ap.Configuracion.AreaCorrecta_ET,
                                               ap.Configuracion.Estimulo_ET,
                                               ap.Configuracion.ColorZonaOpaca_ET,
                                               ap.Configuracion.TeclaReaccion_ET);
                    t.ShowDialog(this);
                    this.ap.Adicionar_Resultado(t.Resultado);
                    //if (this.checkBoxMostrarResultado.Checked)
                    //{
                    //    var rep = new Reporte(ap.Paciente, t.r);
                    //    rep.ShowDialog(this);
                    //}
                }
            }
        }
Beispiel #11
0
 public async Task Run(string[] args)
 {
     var video          = new Video(this._upscaleSettings, this._loggerFactory.CreateLogger <Video>());
     var timeEstimation = new TimeEstimation(video, this._loggerFactory.CreateLogger <TimeEstimation>());
     await video.Upscale(this._waifu2X, this._videoConverter);
 }