Exemplo n.º 1
0
        public void reload(Spectrometer spec)
        {
            this.spec = spec;

            if (spec.lastSpectrum is null)
            {
                // for testing, default measurements with a sine-wave
                raw = new double[spec.pixels];
                double halfMax = 50000.0 / 2.0;
                for (int x = 0; x < raw.Length; x++)
                {
                    raw[x] = halfMax + halfMax * Math.Sin(x * Math.PI * 2 / raw.Length);
                }
            }
            else
            {
                raw = spec.lastSpectrum;
            }

            processed = (double[])raw.Clone();  // MZ: needed?

            dark = spec.dark;
            applyDark();

            var serialNumber = spec is null ? "sim" : spec.eeprom.serialNumber;

            measurementID = string.Format("enlighten-{0}-{1}",
                                          timestamp.ToString("yyyyMMdd-HHmmss-ffffff"),
                                          serialNumber);
            filename = measurementID + ".csv";

            location = WhereAmI.getInstance().location;
        }
Exemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////
        // Lifecycle
        ////////////////////////////////////////////////////////////////////////

        static public Spectrometer getInstance()
        {
            if (instance is null)
            {
                instance = new Spectrometer();
            }
            return(instance);
        }
Exemplo n.º 3
0
 public void reset()
 {
     raw      = dark = reference = processed = null;
     filename = measurementID = null;
     spec     = null;
 }