Beispiel #1
0
        int GetChannelFromEnergy(Detector det, double E, int startX, int endX)
        {
            // Locate a suitable channel for a given energy, return -1 if none is found

            // FIXME: O(log n) ?
            double epsilon = 2d;

            for (int x = startX; x < endX; x++)
            {
                double e = det.GetEnergy(x);
                if (Math.Abs(E - e) < epsilon)
                {
                    return(x);
                }
            }
            return(-1);
        }
Beispiel #2
0
        private void tbZeroPolynomial_TextChanged(object sender, EventArgs e)
        {
            double testZero;

            try
            {
                testZero = Convert.ToDouble(tbZeroPolynomial.Text.Trim());
            }
            catch
            {
                return;
            }

            if (detector.EnergyCurveCoefficients.Count > 0)
            {
                detector.EnergyCurveCoefficients[0] = testZero;
            }
            lblEnergy.Text = detector.GetEnergy(channel).ToString();
        }
        private void pane_MouseMove(object sender, MouseEventArgs e)
        {
            if (session == null || bmpPane == null || WindowState == FormWindowState.Minimized)
            {
                return;
            }

            try
            {
                // Show channel
                int mouseChannel = leftX + e.X;
                labelChannel.Text = "Ch: " + String.Format("{0:###0}", mouseChannel);

                // Show session index
                if (e.Y < session.Spectrums.Count - 1 && e.Y >= 0 && e.Y < bmpPane.Height)
                {
                    int sessionId = Utils.ToArgb(bmpPane.GetPixel(0, e.Y));
                    labelSpectrum.Text = "Idx: " + sessionId.ToString();
                }
                else
                {
                    labelSpectrum.Text = "";
                }

                // Show energy
                if (session.IsLoaded && currentDetector != null)
                {
                    double en = currentDetector.GetEnergy(e.X);
                    labelEnergy.Text = "En: " + String.Format("{0:#######0.0###}", en);
                }
                else
                {
                    labelEnergy.Text = "";
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
            }
        }
Beispiel #4
0
        public double CalculateDoserate(Detector det, dynamic GEFactorFunc)
        {
            // Calculate doserate for this spectrum

            if (det == null || GEFactorFunc == null)
                return 0d;                        
            
            Doserate = 0.0;

            // Trim off discriminators
            int startChan = (int)((double)det.CurrentNumChannels * ((double)det.CurrentLLD / 100.0));
            int endChan = (int)((double)det.CurrentNumChannels * ((double)det.CurrentULD / 100.0));
            if(endChan > det.CurrentNumChannels) // FIXME: Can not exceed 100% atm
                endChan = det.CurrentNumChannels;

            // Accumulate doserates of each channel
            for (int i = startChan; i < endChan; i++)
            {
                float sec = (float)Livetime / 1000000f;                
                float cps = Channels[i] / sec;
                double E = det.GetEnergy(i);
                if (E < 0.05) // Energies below 0.05 are invalid
                    continue;
                double GE = GEFactorFunc(E / 1000.0);
                double chanDose = GE * (cps * 60.0);
                Doserate += chanDose;                
            }

            return Doserate;
        }
Beispiel #5
0
        int GetChannelFromEnergy(Detector det, double E, int startX, int endX)
        {
            // Locate a suitable channel for a given energy, return -1 if none is found

            // FIXME: O(log n) ?
            double epsilon = 2d;
            for (int x = startX; x < endX; x++)
            {
                double e = det.GetEnergy(x);
                if (Math.Abs(E - e) < epsilon)
                    return x;
            }
            return -1;
        }