Files
2026-11-19 16:42:26 +08:00

148 lines
4.3 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CfLibs
{
// ==================== 对外数据结构 ====================
public class SpectrumPoint
{
public double Wavelength;
public double Intensity;
}
public class RawSpectrum
{
public List<SpectrumPoint> Points = new List<SpectrumPoint>();
}
public class MatchedLine
{
public string Element; //元素名称
public double WavelengthSource; //原始测量波长(nm):原始光谱中实际找到的谱峰位置,用于回溯/按波长取强度
public double Wavelength; //波长(nm):定性时匹配到的谱线库(如 NIST)波长
public double Intensity; //强度
public double TransProb; //跃迁概率 A (s^-1)
public double UpperLevel; //上能级 Ek (eV)
public double StatWeight; //统计权重 g
public int Ionization; //电离状态: 0=原子线(I), 1=离子线(II)
}
public class SpectralLines
{
public List<MatchedLine> Lines = new List<MatchedLine>();
}
// ==================== 内部数据结构 ====================
internal class ElementLines
{
public string Element; //元素名称
public int Ionization; //电离状态: 0=原子线(I), 1=离子线(II)
public List<double> Wavelengths = new List<double>();
}
internal class DetectedPeak
{
public double Wavelength;
public double Intensity;
public double Snr;
}
internal class MatchResult
{
public string Element;
public int Ionization;
public int MatchedLines;
public int TotalLines;
public double Confidence;
public List<double> MatchedWavelengths = new List<double>();
public string SpeciesLabel => Element + (Ionization == 0 ? " I" : " II");
}
internal class NistLine
{
public string Element;
public double Wavelength;
public double Intensity;
public double TransProb;
public double UpperLevel;
public double StatWeight;
public int Ionization;
public bool HasFullParams;
}
internal class SpecData
{
public string EleName;
public double WavelengthSource; //原始测量波长(谱峰位置)
public double WaveLength; //匹配到的谱线库波长
public double Intensity;
public double TransPro;
public double UpperLevel;
public double Statis;
public int Ionization;
}
internal class FixData
{
public double Wavelength;
public double Fix;
}
internal class DedupEntry
{
public SpecData Sd;
public double Dist;
}
// ==================== 对外的定量结果 ====================
/// <summary>单个元素的定量结果</summary>
public class ElementResult
{
public string Element; // 元素名称
public double Abundance; // 最终重量百分比(可能含标样校正)
public double RawAbundance; // 校正前重量百分比
public double AbundanceAtom; // 原子数百分比(原C++固定为0)
public double Csa; // 原子态浓度 cm^-3
public double Csit; // 离子态浓度(Saha 修正后)cm^-3
public double Temperature; // 该元素对应温度 K
public double ElectronDensity; // 该元素对应电子密度 cm^-3
}
/// <summary>定量分析完整结果</summary>
public class Result
{
public List<ElementResult> Elements = new List<ElementResult>();
public double Temperature;
public double ElectronDensity;
public int Status;
public string ErrorMsg = "";
}
// ==================== 内部数据结构 ====================
internal class ElementCount
{
public string EleName;
public int Count;
}
internal class ElementData
{
public string EleName;
public int AtomNum;
public int IonNum;
public int AtomNumCS;
public int IonNumCS;
public double Bsa;
public double Bsi;
public double Csa;
public double Csit;
public double Abundence;
public double RawAbundence;
}
}