import DoasCore;
import DoasCore.Spectra;
import DoasCore.Math;
import DoasCore.IO;
var Path = "C:
\\Fitszenarios";
var FitFile = "Fitszenario.fs";
var FitLow = 320;
var FitHigh = 420;
var Frauenhofer :
ISpectrum = Specbar.GetSpectrum("Frauenhofer");
var Ring :
ISpectrum = Specbar.GetSpectrum("Ring");
var O3223 :
ISpectrum = Specbar.GetSpectrum("O3(223K)");
var O3246 :
ISpectrum = Specbar.GetSpectrum("O3(246K)");
Frauenhofer.Open(Path + FrauenhoferFile);
Ring.Open(Path + RingFile);
O3223.Open(Path + "Ozon
\\Ozon223Gefaltet.sp2");
O3246.Open(Path + "Ozon
\\Ozon246Gefaltet.sp2");
var fit :
DoasFit = new DoasFit();
fit = DoasFit.Open(Path + FitFile);
fit.FitRanges[0].LimitLow = FitLow;
fit.FitRanges[0].LimitHigh = FitHigh;
fit.OffsetPolynomialOrder = 2;
fit.ReferencesInfo[0].ReferenceSpectrum = Frauenhofer;
fit.ReferencesInfo[1].ReferenceSpectrum = Ring;
fit.ReferencesInfo[2].ReferenceSpectrum = O3223;
fit.ReferencesInfo[3].ReferenceSpectrum = O3246;
DoasFit.Save(fit, Path + FitFile);
Warning:
If you want to describe the path of a file in JScipt you have to
use two ”backslashes” instead of one.
e.g. ”C:\\Fitszenarios\\Ozon\\Ozon223Gefaltet.sp2”
7.3
DoasCore.Device
The DoasCore.Device namespace contains classes for each of the supported devices, and
general interfaces. The most common are:
• DoasCore.Device.Spectrograph: this is a common device access class, it supports scan-
ning using the currently selected device.
• DoasCore.Device.ISpectrograph interface that is implemented by all specific spectro-
graphs
• DoasCore.Device.OceanOptics: this spectrograph is implemented in MiniDoas appa-
ratuses
27
• DoasCore.Device.Acton: another spectrograph often used
Here is an example how to perform one scan with the Ocean Optics Spectrograph:
import DoasCore;
import DoasCore.Spectra;
import DoasCore.Device;
var NScan = 1000; var ExpTime = 1; var MiniDoas :
OceanOptics = new OceanOptics();
var Spec1 :
ISpectrum = Specbar.GetSpectrum("Offset1");
MiniDoas.Scan(Spec1,NScan,ExpTime);
Note that the Scan method is not only a member of the OceanOptics class in the Doas-
Core.Device namepace, but also of the Acton class and the interface class ISpectograph,
from which all specific spectographs inherit members. The parameters of the Scan method
are the name of the spectrum in which the measuremen shall be stored, the number of scans
that shall be performed, and the exposure time for each scan. The Properties NumScans
and ExposureTime are also members of all devices.
Hint:
Using the generic class Spectrograph allows to scan without the
need to know the exact hardware used.
7.4
DoasCore.IO
The DoasCore.IO namespace is used for handling the input and output of Doas-specific data,
most importantly spectra.
• DoasCore.IO.SpectrumFile: allows to open and save spectra
• DoasCore.IO.AutoFileName: allows to open and save a set of spectra, automatically
numbered
The usage of the AutoFileName class is illustrated in section 12.4.
7.5
DoasCore.Spectra
This namespace is used to manage a set of spectra. The important classes are:
• DoasCore.Spectra.Spectrum: Basic object that represents a spectrum within Doasis
• DoasCore.Spectra.ISpectrum: An interface for the spectrum class.
• DoasCore.Spectra.Specbar: A collection of spectra that will be visible in the Specbar
of the graphical user interface
28
7.5.1
DoasCore.Spectra.ISpectrum
The most important object here is the ISpectrum object. For example, one can modify the
current spectrum with it. Here is an example of a function that searches the peak of a
spectrum:
import System;
import DoasCore.Spectra;
var Spec :
ISpectrum = Specbar.CurrentSpectrum;
function SetMarkerToPeak()
{
Spec.Marker = Spec.MinChannel;
while(Spec.MarkerValue < Spec.Max) Spec.Marker++;
System.Console.WriteLine("Peak bei Kanal :
" + Spec.Marker);
}
SetMarkerToPeak();
There are quite a lot members in the ISpectrum object: Marker, MinChannel, MaxChannel,
MarkerValue, and many more (ObjectKey, FileName, StartTime, StopTime, AzimuthAngle,...)
To each property in the property tab of a spectrum there is a member in the ISpectrum
class that can be used in a JScript. A complete list can be found in the Programming
Documentation in the ”help”-menu of DOASIS. Just search for ”ISpectrum”!
7.5.2
DoasCore.Spectra.Specbar
The specbar contains the object Specbar.CurrentSpectrum. This allows to access data of
the current spectrum (the one that is displayed in the main window). Here is an example
that sets the coefficients of the calibration polynomial (which assigns wavelength info to the
channels):
import Doas.Core;
import DoasCore.Spectra;
var Spec1 :
ISpectrum = Specbar.CurrentSpectrum;
var Spec2 :
ISpectrum = Specbar.GetSpectrum("Halogen1");
Spec1.CalibPolynomialOrder = 2;
Spec1.CalibPolynomial[0]= 297.51431;
Spec1.CalibPolynomial[1]= 0.12086;
Spec1.CalibPolynomial[2]= -9.60429e-6;
Spec1.SaveAs("modified");
Spec2.ExposureTime= 10000;
Spec2.SaveAs("modified2");
Specbar.CloseAllSpectra();
29
Dostları ilə paylaş: |