public string LogConfiguration() { var data = "\n\n[RESULTS]\n"; data += "Reflection limits for " + m_SysConf.mainOrder + " order\n"; data += "Min wavelength = " + m_SysConf.waveLimits?.min.lambda.ToString() + "\tPosition = " + m_SysConf.waveLimits?.min.position.ToString() + "\n"; data += "Max wavelength = " + m_SysConf.waveLimits?.max.lambda.ToString() + "\tPosition = " + m_SysConf.waveLimits?.max.position.ToString() + "\n"; data += "Reference line = " + m_SysConf.ZeroWaveStr + "\n";; data += "Dispersion curve: " + m_SelectedWaves.GetZeroWave()?.Curve?.ToString() + "\n"; data += "***************************************************************\n"; data += "Name\tWavelength\tEmitted\tReflected\tEfficiency\tXCoords\tMagnification\tFWHM\tOrder\tLine Width\n"; foreach (var w in m_SelectedWaves.Wave) { data += String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\n", w.name, Extension.mstr(w.lambda), Extension.mstr(w.Emited), Extension.mstr(w.Reflected), w.Efficiency, Extension.mstr(w.XCoord), Extension.mstr(w.Magnification), Extension.mstr(w.FWHM), Extension.mstr(w.Order), Extension.mstr(w.FWHM)); } data += "\n\nDispercion curves for the following reference lines\n"; foreach (var l in m_SelectedWaves.Wave) { data += "For L_ref = " + Extension.mstr(l.lambda) + ":\t" + l.Curve?.ToString() + "\n"; } if (m_AdditionalApproximation != null) { data += "\n\nAdditional fits\n"; data += "Efficiency curve:" + m_AdditionalApproximation?.m_EfficiencyFit.ToString() + "\n"; data += "Magnification curve:" + m_AdditionalApproximation?.m_MagnificationFit.ToString() + "\n"; if (m_AproximatedWavePoints != null) { data += "***************************************************************\n"; data += "Name\tWavelength\tEfficiency\tFit_Efficiency\tEfficiency_fit_quality\tMagnification\tFit_Magnification\tMagnification_fit_quality\n"; foreach (var w in m_AproximatedWavePoints) { data += String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\n", w.name, Extension.mstr(w.lambda), w.Efficiency, w.Approx_Efficiency, Extension.mstr(Math.Abs(w.Approx_Efficiency - w.Efficiency) / w.Efficiency), Extension.mstr(w.Magnification), Extension.mstr(w.Approx_Magnification), Extension.mstr(Math.Abs(w.Approx_Magnification - w.Magnification) / w.Magnification) ); } } } data += m_SysConf.GetCrystalConfig(); return(data); }
public string GenerateOutputConfig() { var data = ""; data += "[INPUT]\n"; data += "Spectometer type = " + spectrometer_type.ToString() + "\n"; data += "Crystal type = " + CrystType + "\n"; try { data += "Crystal 2d = " + Extension.mstr(CrystalProps?.crystal2d[mainOrder - 1]) + " [A]\n"; } catch (Exception e) { data += e.ToString(); } data += "Crystal radius R = " + Extension.mstr(crystalR) + " [mm]\n"; data += "Crystal W x H = " + Extension.mstr(crystalW) + " X " + Extension.mstr(crystalH) + " [mm]\n"; data += "Source size W x H= " + Extension.mstr(SrcSizeW) + " X " + Extension.mstr(SrcSizeH) + " [mm]\n"; data += "Detector size W x H= " + Extension.mstr(FilmSizeW) + " X " + Extension.mstr(FilmSizeH) + " [mm]\n"; data += "Central wavelength = " + Extension.mstr(centralWave) + " [A]\n"; data += "Source distance = " + Extension.mstr(SrcDist) + " [mm]\n"; data += "Main reflection order m = " + Extension.mstr(mainOrder) + "\n"; data += "Source solid angle = " + Extension.mstr(SolidCone) + " [sr]\n"; data += "\n\n[OUTPUT]\n"; data += "Bragg Angle = " + Extension.mstr(BraggA) + " [deg]\n"; data += "Incident Angle = " + Extension.mstr(90.0 - BraggA) + " [deg]\n"; if (spectrometer_type == SpectrometerType.TWO_ARM) { data += "FRO angle = " + Extension.mstr(180.0 - ToFilmDirection) + " [deg]\n"; data += "Detector to center = " + Extension.mstr(FilmDistFromCenter) + " [mm]\n"; } data += "Detector angle = " + Extension.mstr(FilmRotationAngle) + " [deg]\n"; data += "Detector to crystal = " + Extension.mstr(DstDist) + " [mm]\n"; if (ObjectExist) { data += "\n\n[OBJECT]\n"; data += String.Format("Map = {0}\n", Object.GridMap); data += String.Format("Distance = {0} [mm]\n", Object.GridPosition); data += String.Format("Position = {0} crystal\n", (Object.GridLocation == 1) ? "after" : "before"); data += String.Format("Object W x H = {0} X {1} [mm]\n", Object.GridWidth, Object.GridHeight); data += String.Format("PixelSizeX = {0} [mm]\n", Object.GridPixelSizeX); data += String.Format("PixelSizeY = {0} [mm]\n", Object.GridPixelSizeY); } return(data); }
public override string ToString() { if (Math.Abs(a) >= 1e-4 && Math.Abs(b) >= 1e-4 && Math.Abs(c) >= 1e-4) { return((isExist) ? String.Format("F(wavelenght=X) = {0}*X^2 + {1}*X + {2}", Extension.mstr(a), Extension.mstr(b), Extension.mstr(c)) : "Unable to construct curve"); } else { return((isExist) ? String.Format("F(wavelenght=X) = {0}*X^2 + {1}*X + {2}", b, b, c) : "Unable to construct curve"); } }
public override String ToString() { return((isExist) ? String.Format("Wavelength(x) = {0}*X^2 + {1}*X + {2}", Extension.mstr(a), Extension.mstr(b), Extension.mstr(c)): "Unable to construct curve"); }
public void UpdateConfigurationWithNewCentralWave() { if (CrystalProps == null) { throw new Exception("No crystal file"); } var sTheta = centralWave / (CrystalProps.crystal2d[mainOrder - 1] / mainOrder); if (sTheta > 1.0) { throw new Exception("Bad central wave for selected order. Use wavelength less than " + Extension.mstr((CrystalProps.crystal2d[mainOrder - 1] / mainOrder)) + " [A]"); } BraggA = Math.Asin(sTheta) * 180.0 / Math.PI; UpdateConfiguration(); }
public void ConstructFSSR1() { if (CrystalProps == null) { throw new Exception("No crystal file"); } var sTheta = centralWave / (CrystalProps.crystal2d[mainOrder - 1] / mainOrder); if (sTheta > 1.0) { throw new Exception("Bad central wave for selected order. Use wavelength less than " + Extension.mstr((CrystalProps.crystal2d[mainOrder - 1] / mainOrder)) + " [A]"); } BraggA = Math.Asin(sTheta) * 180.0 / Math.PI; var phi = (90.0 - BraggA) * Math.PI / 180.0; SrcDist = crystalR * Math.Cos(phi) / Math.Cos(2 * phi); DstDist = crystalR * Math.Cos(phi); MainGeometry(phi); }