重构代码
1、将读取定标文件(rad、NonLinear)的功能,从文件ProjectManager.cs重构到文件SpectralProcessor.cs中的一个类(calAndNonLinearFileReader)中; 2、从文件ProjectManager.cs中重构出辐亮度转换方法,添加到文件SpectralProcessor.cs中SpectralProcessor类中的方法processDirectory_dn2rad → 这是为了兼容辐亮度转换命令行程序(用于整合到通量系统中);
This commit is contained in:
@ -9,7 +9,6 @@ using System.Windows.Forms;
|
||||
|
||||
namespace mainProgram
|
||||
{
|
||||
public delegate void UpdateProgressBarInfoDelegate(int ipos, string vinfo);//申明委托类型:用于进度条的更新
|
||||
public delegate void RadCompleteDelegate();//申明委托类型:福亮度完成后调用的委托
|
||||
|
||||
public class DateFolder : IComparable//接口
|
||||
@ -746,138 +745,28 @@ namespace mainProgram
|
||||
}
|
||||
}
|
||||
|
||||
public int getNonLinearFileCount()
|
||||
{
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(mMetadataPath);
|
||||
int txtFileCount = 0;
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)//
|
||||
{
|
||||
if (metaFilesPath[i].Contains("nonLinear"))
|
||||
{
|
||||
txtFileCount++;
|
||||
}
|
||||
}
|
||||
return txtFileCount;
|
||||
}
|
||||
|
||||
public int getCalFileCount()
|
||||
{
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(mMetadataPath);
|
||||
int datFileCount = 0;
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)//
|
||||
{
|
||||
if (metaFilesPath[i].Contains("cal"))
|
||||
{
|
||||
datFileCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return datFileCount;
|
||||
}
|
||||
|
||||
//如果一个委托不需要再其定义的类之外被触发,那么就可以将其转化为事件,这样可以保证它不会在外部被随意触发。
|
||||
//public UpdateProgressBarInfoDelegate UpdateProgressBarInfo;//申明委托变量
|
||||
public event UpdateProgressBarInfoDelegate UpdateProgressBarInfoEvent;//申明事件
|
||||
//public RadCompleteDelegate RadComplete;//申明委托变量
|
||||
public event RadPercentCompleteDelegate UpdateProgressBarInfoEvent;//申明事件
|
||||
public event RadCompleteDelegate RadCompleteEvent;//申明委托变量
|
||||
|
||||
private void EventRelay(int ipos, string vinfo)
|
||||
{
|
||||
UpdateProgressBarInfoEvent(ipos, vinfo);
|
||||
}
|
||||
|
||||
//处理工程中的数据
|
||||
public void Rad()
|
||||
{
|
||||
int counter = 0;
|
||||
//读取标定文件:辐射定标文件 + 非线性校正文件
|
||||
int datFileCount = getCalFileCount();
|
||||
int txtFileCount = getNonLinearFileCount();
|
||||
|
||||
CalData[] calDatas = new CalData[datFileCount];
|
||||
NonLinearData[] nonLinearDatas = new NonLinearData[txtFileCount];
|
||||
|
||||
int d1 = 0, d2 = 0;
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(mMetadataPath);
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)
|
||||
{
|
||||
if (metaFilesPath[i].Contains("nonLinear"))
|
||||
{
|
||||
nonLinearDatas[d1] = ReadNonLinearFile(metaFilesPath[i]);
|
||||
d1++;
|
||||
}
|
||||
else if (metaFilesPath[i].Contains("cal"))
|
||||
{
|
||||
calDatas[d2] = ReadCalFile(metaFilesPath[i]);
|
||||
d2++;
|
||||
}
|
||||
}
|
||||
CalData[] calDatas;
|
||||
NonLinearData[] nonLinearDatas;
|
||||
calAndNonLinearFileReader.readCalAndNonLinearFile(mMetadataPath, out calDatas, out nonLinearDatas);
|
||||
|
||||
//对文件夹中的文件遍历处理:非线性校正 + 辐射定标
|
||||
Console.WriteLine("工程目录为" + mProjectPath);
|
||||
DelectDir(mRadPath);
|
||||
string[] sourceFilesPath = Directory.GetFileSystemEntries(mRawPath);
|
||||
|
||||
for (int i = 0; i < sourceFilesPath.Length; i++)//mRawPath下的每个日期文件夹
|
||||
{
|
||||
//构建rad中的输出文件夹
|
||||
string[] forlders = sourceFilesPath[i].Split('\\');
|
||||
string lastDirectory = forlders[forlders.Length - 1];
|
||||
string dest = Path.Combine(mRadPath, lastDirectory);
|
||||
|
||||
if (!Directory.Exists(dest))
|
||||
{
|
||||
Directory.CreateDirectory(dest);
|
||||
}
|
||||
|
||||
|
||||
string[] rawFiles = Directory.GetFileSystemEntries(Path.Combine(mRawPath, lastDirectory));
|
||||
foreach (string rawFileName in rawFiles)//日期文件夹下的每个DN值csv文件
|
||||
{
|
||||
string[] nameTmp = rawFileName.Split('\\');
|
||||
string name = nameTmp[nameTmp.Length - 1];
|
||||
|
||||
SpectralDataReaderWriter spectralDataReaderWriter = new SpectralDataReaderWriter(rawFileName);
|
||||
for (int j = 1; j <= spectralDataReaderWriter.TotalSpectralCount; j++)//处理 csv文件中的每条光谱
|
||||
{
|
||||
SpectralData spectralData = spectralDataReaderWriter.GetSpectral(j);
|
||||
|
||||
int nonLinearData_index = GetnonLinearDataIndex(spectralData, nonLinearDatas);
|
||||
int calData_index = GetCalDataIndex(spectralData, calDatas);
|
||||
|
||||
SpectralProcessor sp = new SpectralProcessor();
|
||||
|
||||
if (nonLinearData_index >= 0)//非线性校正
|
||||
{
|
||||
sp.NonLinearCorrection(nonLinearDatas[nonLinearData_index].nonLinearData, spectralData.spectral, spectralData.spectralDataLength);
|
||||
}
|
||||
if (calData_index >= 0)//福亮度转换
|
||||
{
|
||||
sp.RadCorrection(calDatas[calData_index].gain, calDatas[calData_index].exposureTime, spectralData.spectral, spectralData.exposureTime, spectralData.spectralDataLength);
|
||||
}
|
||||
spectralDataReaderWriter.UpdateSpectral(j, spectralData);
|
||||
}
|
||||
|
||||
string destFileName = Path.Combine(dest, name);
|
||||
spectralDataReaderWriter.SaveCSV(destFileName);
|
||||
|
||||
counter++;
|
||||
float tmp1 = (float)counter / (float)mCsvFileCount;
|
||||
float tmp2 = tmp1 * 100;
|
||||
|
||||
|
||||
//if (UpdateProgressBarInfo != null)//确认委托有方法
|
||||
//{
|
||||
// UpdateProgressBarInfo((int)tmp2, name + "\r\n");
|
||||
//}
|
||||
|
||||
if (UpdateProgressBarInfoEvent != null)
|
||||
{
|
||||
UpdateProgressBarInfoEvent((int)tmp2, name + "\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////福亮度转换完成后,需要做得动作
|
||||
//if (RadComplete != null)//确认委托有方法
|
||||
//{
|
||||
// RadComplete();
|
||||
//}
|
||||
SpectralProcessor sp = new SpectralProcessor();
|
||||
sp.RadPercentCompleteEvent += EventRelay;
|
||||
sp.processDirectory_dn2rad(mRawPath, mRadPath, calDatas, nonLinearDatas, true, mCsvFileCount);
|
||||
|
||||
if (RadCompleteEvent != null)//确认事件有方法可以执行
|
||||
{
|
||||
@ -886,118 +775,6 @@ namespace mainProgram
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
返回值:-1代表没有匹配项
|
||||
*/
|
||||
public int GetnonLinearDataIndex(SpectralData spectralData, NonLinearData[] nonLinearData)
|
||||
{
|
||||
for (int i = 0; i < nonLinearData.GetLength(0); i++)
|
||||
{
|
||||
if (nonLinearData[i].SN.Contains(spectralData.SN))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
返回值:-1代表没有匹配项
|
||||
*/
|
||||
public int GetCalDataIndex(SpectralData spectralData, CalData[] calData)
|
||||
{
|
||||
for (int i = 0; i < calData.GetLength(0); i++)
|
||||
{
|
||||
if (calData[i].SN.Contains(spectralData.SN) && calData[i].position==spectralData.position)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
public CalData ReadCalFile(string calFilePath)
|
||||
{
|
||||
CalData calFile;
|
||||
|
||||
string[] forlders = calFilePath.Split('\\');
|
||||
string filename = forlders[forlders.Length - 1].Split('.')[0];
|
||||
|
||||
string[] tmp = filename.Split('_');
|
||||
calFile.SN = tmp[0];
|
||||
|
||||
calFile.SN = filename;
|
||||
calFile.position = int.Parse(tmp[tmp.Length - 1]);
|
||||
|
||||
FileStream fs2 = new FileStream(calFilePath, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader br = new BinaryReader(fs2);
|
||||
calFile.exposureTime = br.ReadUInt32();
|
||||
calFile.temperature = br.ReadSingle();
|
||||
calFile.pixelCount = br.ReadInt32();
|
||||
calFile.waveLengthInNM = new float[calFile.pixelCount];
|
||||
calFile.gain = new double[calFile.pixelCount];
|
||||
calFile.offset = new double[calFile.pixelCount];
|
||||
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.waveLengthInNM[ii] = br.ReadSingle();
|
||||
}
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.gain[ii] = br.ReadDouble();
|
||||
}
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.offset[ii] = br.ReadDouble();
|
||||
}
|
||||
|
||||
return calFile;
|
||||
}
|
||||
|
||||
public NonLinearData ReadNonLinearFile(string nonLinearFilePath)
|
||||
{
|
||||
NonLinearData nonLinearData;
|
||||
string[] forlders = nonLinearFilePath.Split('\\');
|
||||
nonLinearData.SN = forlders[forlders.Length - 1].Split('.')[0];
|
||||
|
||||
|
||||
int lineCount = FindMaxRowCount(nonLinearFilePath);
|
||||
nonLinearData.nonLinearData = new double[lineCount];
|
||||
|
||||
FileStream fs = new FileStream(nonLinearFilePath, FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(fs);
|
||||
string strLine = "";//记录每次读取的一行记录
|
||||
|
||||
int i = 0;
|
||||
while ((strLine = sr.ReadLine()) != null)//逐行读取CSV中的数据
|
||||
{
|
||||
nonLinearData.nonLinearData[i] = double.Parse(strLine);
|
||||
i++;
|
||||
}
|
||||
|
||||
return nonLinearData;
|
||||
}
|
||||
|
||||
public int FindMaxRowCount(string filePath)
|
||||
{
|
||||
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(fs);
|
||||
|
||||
string strLine = "";
|
||||
int maxColunmCount = 0;
|
||||
|
||||
while ((strLine = sr.ReadLine()) != null)
|
||||
{
|
||||
maxColunmCount++;
|
||||
}
|
||||
|
||||
sr.Close();
|
||||
fs.Close();
|
||||
|
||||
return maxColunmCount;
|
||||
}
|
||||
|
||||
DateFolder[] df;
|
||||
public void FindTimespan()//因为此函数会递归,所以把它摘出来
|
||||
{
|
||||
|
@ -35,9 +35,7 @@ namespace mainProgram
|
||||
var addr2 = getMemory(mProjectManager);
|
||||
Console.WriteLine("子窗口变量的地址 = " + addr2);
|
||||
|
||||
//mProjectManager.UpdateProgressBarInfo = new UpdateProgressBarInfoDelegate(UpdateWidgetInfo);
|
||||
mProjectManager.UpdateProgressBarInfoEvent += UpdateWidgetInfo;//向事件中注册事件处理程序
|
||||
//mProjectManager.RadComplete = new RadCompleteDelegate(RadComplete);
|
||||
mProjectManager.RadCompleteEvent += RadComplete;
|
||||
|
||||
Thread t1 = new Thread(new ThreadStart(mProjectManager.Rad));
|
||||
@ -52,7 +50,7 @@ namespace mainProgram
|
||||
|
||||
if (this.InvokeRequired) //InvokeRequired属性为真时,说明一个创建它以以外的线程(即SleepT)想访问它
|
||||
{
|
||||
UpdateProgressBarInfoDelegate setpos = new UpdateProgressBarInfoDelegate(UpdateWidgetInfo);
|
||||
RadPercentCompleteDelegate setpos = new RadPercentCompleteDelegate(UpdateWidgetInfo);
|
||||
this.Invoke(setpos, new object[] { ipos, vinfo });//SleepT线程调用本控件Form1中的方法
|
||||
}
|
||||
else
|
||||
|
@ -8,18 +8,10 @@ using System.IO;
|
||||
|
||||
namespace mainProgram
|
||||
{
|
||||
public delegate void RadPercentCompleteDelegate(int ipos, string vinfo);//申明委托类型:用于通知福亮度校正的进度
|
||||
|
||||
class SpectralProcessor
|
||||
{
|
||||
public void OpenNolinerData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OpenCalData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void NonLinearCorrection(double[] coefficient, double[] rawData, int bandnumber)
|
||||
{
|
||||
for (int i = 0; i < bandnumber; i++)
|
||||
@ -51,6 +43,258 @@ namespace mainProgram
|
||||
|
||||
}
|
||||
|
||||
public void DelectDir(string srcPath)
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(srcPath);
|
||||
FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录
|
||||
foreach (FileSystemInfo i in fileinfo)
|
||||
{
|
||||
if (i is DirectoryInfo) //判断是否文件夹
|
||||
{
|
||||
DirectoryInfo subdir = new DirectoryInfo(i.FullName);
|
||||
subdir.Delete(true); //删除子目录和文件
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Delete(i.FullName); //删除指定文件
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public event RadPercentCompleteDelegate RadPercentCompleteEvent;//申明事件
|
||||
public void processDirectory_dn2rad(string sourceDirectory, string destDirectory, CalData[] calDatas, NonLinearData[] nonLinearDatas, bool isdeleteDest = false, int CsvFileCounter = 0)//包含了工程目录结构
|
||||
{
|
||||
if(isdeleteDest)
|
||||
DelectDir(destDirectory);
|
||||
|
||||
string[] sourceFilesPath = Directory.GetFileSystemEntries(sourceDirectory);
|
||||
|
||||
int counter = 0;
|
||||
for (int i = 0; i < sourceFilesPath.Length; i++)//sourceDirectory下的每个日期文件夹
|
||||
{
|
||||
//构建rad中的输出文件夹
|
||||
string[] forlders = sourceFilesPath[i].Split('\\');
|
||||
string lastDirectory = forlders[forlders.Length - 1];
|
||||
string dest = Path.Combine(destDirectory, lastDirectory);
|
||||
|
||||
if (!Directory.Exists(dest))
|
||||
{
|
||||
Directory.CreateDirectory(dest);
|
||||
}
|
||||
|
||||
|
||||
string[] rawFiles = Directory.GetFileSystemEntries(Path.Combine(sourceDirectory, lastDirectory));
|
||||
foreach (string rawFileName in rawFiles)//日期文件夹下的每个DN值csv文件
|
||||
{
|
||||
string[] nameTmp = rawFileName.Split('\\');
|
||||
string name = nameTmp[nameTmp.Length - 1];
|
||||
|
||||
SpectralDataReaderWriter spectralDataReaderWriter = new SpectralDataReaderWriter(rawFileName);
|
||||
for (int j = 1; j <= spectralDataReaderWriter.TotalSpectralCount; j++)//处理 csv文件中的每条光谱
|
||||
{
|
||||
SpectralData spectralData = spectralDataReaderWriter.GetSpectral(j);
|
||||
|
||||
int nonLinearData_index = calAndNonLinearFileReader.GetnonLinearDataIndex(spectralData, nonLinearDatas);
|
||||
int calData_index = calAndNonLinearFileReader.GetCalDataIndex(spectralData, calDatas);
|
||||
|
||||
if (nonLinearData_index >= 0)//非线性校正
|
||||
{
|
||||
NonLinearCorrection(nonLinearDatas[nonLinearData_index].nonLinearData, spectralData.spectral, spectralData.spectralDataLength);
|
||||
}
|
||||
if (calData_index >= 0)//福亮度转换
|
||||
{
|
||||
RadCorrection(calDatas[calData_index].gain, calDatas[calData_index].exposureTime, spectralData.spectral, spectralData.exposureTime, spectralData.spectralDataLength);
|
||||
}
|
||||
spectralDataReaderWriter.UpdateSpectral(j, spectralData);
|
||||
}
|
||||
|
||||
string destFileName = Path.Combine(dest, name);
|
||||
spectralDataReaderWriter.SaveCSV(destFileName);
|
||||
|
||||
counter++;
|
||||
|
||||
if (CsvFileCounter != 0)
|
||||
{
|
||||
float tmp1 = (float)counter / (float)CsvFileCounter;
|
||||
float tmp2 = tmp1 * 100;
|
||||
|
||||
if (RadPercentCompleteEvent != null)
|
||||
{
|
||||
RadPercentCompleteEvent((int)tmp2, name + "\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class calAndNonLinearFileReader
|
||||
{
|
||||
static private int FindMaxRowCount(string filePath)
|
||||
{
|
||||
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(fs);
|
||||
|
||||
string strLine = "";
|
||||
int maxColunmCount = 0;
|
||||
|
||||
while ((strLine = sr.ReadLine()) != null)
|
||||
{
|
||||
maxColunmCount++;
|
||||
}
|
||||
|
||||
sr.Close();
|
||||
fs.Close();
|
||||
|
||||
return maxColunmCount;
|
||||
}
|
||||
|
||||
static public NonLinearData ReadNonLinearFile(string nonLinearFilePath)
|
||||
{
|
||||
NonLinearData nonLinearData;
|
||||
string[] forlders = nonLinearFilePath.Split('\\');
|
||||
nonLinearData.SN = forlders[forlders.Length - 1].Split('.')[0];
|
||||
|
||||
|
||||
int lineCount = FindMaxRowCount(nonLinearFilePath);
|
||||
nonLinearData.nonLinearData = new double[lineCount];
|
||||
|
||||
FileStream fs = new FileStream(nonLinearFilePath, FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(fs);
|
||||
string strLine = "";//记录每次读取的一行记录
|
||||
|
||||
int i = 0;
|
||||
while ((strLine = sr.ReadLine()) != null)//逐行读取CSV中的数据
|
||||
{
|
||||
nonLinearData.nonLinearData[i] = double.Parse(strLine);
|
||||
i++;
|
||||
}
|
||||
|
||||
return nonLinearData;
|
||||
}
|
||||
|
||||
static public CalData ReadCalFile(string calFilePath)
|
||||
{
|
||||
CalData calFile;
|
||||
|
||||
string[] forlders = calFilePath.Split('\\');
|
||||
string filename = forlders[forlders.Length - 1].Split('.')[0];
|
||||
|
||||
string[] tmp = filename.Split('_');
|
||||
calFile.SN = tmp[0];
|
||||
|
||||
calFile.SN = filename;
|
||||
calFile.position = int.Parse(tmp[tmp.Length - 1]);
|
||||
|
||||
FileStream fs2 = new FileStream(calFilePath, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader br = new BinaryReader(fs2);
|
||||
calFile.exposureTime = br.ReadUInt32();
|
||||
calFile.temperature = br.ReadSingle();
|
||||
calFile.pixelCount = br.ReadInt32();
|
||||
calFile.waveLengthInNM = new float[calFile.pixelCount];
|
||||
calFile.gain = new double[calFile.pixelCount];
|
||||
calFile.offset = new double[calFile.pixelCount];
|
||||
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.waveLengthInNM[ii] = br.ReadSingle();
|
||||
}
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.gain[ii] = br.ReadDouble();
|
||||
}
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.offset[ii] = br.ReadDouble();
|
||||
}
|
||||
|
||||
return calFile;
|
||||
}
|
||||
|
||||
static public int getNonLinearFileCount(string directory)
|
||||
{
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(directory);
|
||||
int txtFileCount = 0;
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)//
|
||||
{
|
||||
if (metaFilesPath[i].Contains("nonLinear"))
|
||||
{
|
||||
txtFileCount++;
|
||||
}
|
||||
}
|
||||
return txtFileCount;
|
||||
}
|
||||
|
||||
static public int getCalFileCount(string directory)//
|
||||
{
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(directory);
|
||||
int datFileCount = 0;
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)//
|
||||
{
|
||||
if (metaFilesPath[i].Contains("cal"))
|
||||
{
|
||||
datFileCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return datFileCount;
|
||||
}
|
||||
|
||||
static public bool readCalAndNonLinearFile(string directory, out CalData[] calDatas, out NonLinearData[] nonLinearDatas)
|
||||
{
|
||||
int datFileCount = getCalFileCount(directory);
|
||||
int txtFileCount = getNonLinearFileCount(directory);
|
||||
|
||||
calDatas = new CalData[datFileCount];
|
||||
nonLinearDatas = new NonLinearData[txtFileCount];
|
||||
|
||||
int d1 = 0, d2 = 0;
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(directory);
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)
|
||||
{
|
||||
if (metaFilesPath[i].Contains("nonLinear"))
|
||||
{
|
||||
nonLinearDatas[d1] = ReadNonLinearFile(metaFilesPath[i]);
|
||||
d1++;
|
||||
}
|
||||
else if (metaFilesPath[i].Contains("cal"))
|
||||
{
|
||||
calDatas[d2] = ReadCalFile(metaFilesPath[i]);
|
||||
d2++;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//返回值:-1代表没有匹配项
|
||||
static public int GetnonLinearDataIndex(SpectralData spectralData, NonLinearData[] nonLinearData)
|
||||
{
|
||||
for (int i = 0; i < nonLinearData.GetLength(0); i++)
|
||||
{
|
||||
if (nonLinearData[i].SN.Contains(spectralData.SN))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//返回值:-1代表没有匹配项
|
||||
static public int GetCalDataIndex(SpectralData spectralData, CalData[] calData)
|
||||
{
|
||||
for (int i = 0; i < calData.GetLength(0); i++)
|
||||
{
|
||||
if (calData[i].SN.Contains(spectralData.SN) && calData[i].position == spectralData.position)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public enum DataStatus { NoData, Raw, NonLinearCorrection, Rad, Sif };
|
||||
|
Reference in New Issue
Block a user