Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed Nov 27, 2023
1 parent 92bdbe0 commit 85e649a
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Crystallography.Controls/Crystallography.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.11.27.1027</AssemblyVersion>
<FileVersion>2023.11.27.1027</FileVersion>
<AssemblyVersion>2023.11.27.1108</AssemblyVersion>
<FileVersion>2023.11.27.1108</FileVersion>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<ApplicationUseCompatibleTextRendering>true</ApplicationUseCompatibleTextRendering>
<ApplicationVisualStyles>true</ApplicationVisualStyles>
Expand Down
2 changes: 0 additions & 2 deletions Crystallography/Atom/AtomStatic.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using MathNet.Numerics.Integration;
using MathNet.Numerics.LinearAlgebra.Double;
using Microsoft.VisualBasic;
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Crystallography.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.11.27.1027</AssemblyVersion>
<FileVersion>2023.11.27.1027</FileVersion>
<AssemblyVersion>2023.11.27.1108</AssemblyVersion>
<FileVersion>2023.11.27.1108</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup>

Expand Down
26 changes: 18 additions & 8 deletions Crystallography/Detector/Ring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,7 @@ public static double[] GetCorrectedImageArray(IntegralProperty iP, double resolu
}
#endregion

#region GetUnrolledImageArray 傾き補正やピクセル補正を除去して切り開き画像を作り出すメソッド

/// <summary>
/// 傾き補正やピクセル補正を除去して切り開き画像を作り出すメソッド
Expand Down Expand Up @@ -1312,6 +1313,7 @@ public static double[] GetUnrolledImageArray(IntegralProperty iP, int chiDivisio
return destPixels;
}


#region UnrolledImageArray ガンドルフィ
private static double[] GetUnrolledImageArrayGandlofi(IntegralProperty iP, int yMin, int yMax, double sectorStep, double startTheta, double endTheta, double stepTheta)
{
Expand Down Expand Up @@ -1443,6 +1445,8 @@ private static double[] GetUnrolledImageArrayGandlofi(IntegralProperty iP, int y
}
#endregion

#endregion

#region お蔵入り GetUnrolledImageArrayThread
/// <summary>
/// 傾き補正やピクセル補正を除去して切り開き画像を作り出すメソッドのスレッド
Expand Down Expand Up @@ -2644,11 +2648,11 @@ public static (double[][] Profile, double[][] Pixels) GetProfileThreadWithTiltCo
//IPの法線ベクトル
(double X, double Y, double Z) detector_normal = (Denom2, Denom1, -CosTau);

var pt0 = new (double X, double Y)[8];
var pt1 = new (double X, double Y)[8];
var pt2 = new (double X, double Y)[8];
var pt3 = new (double X, double Y)[8];
var pt4 = new (double X, double Y)[8];
Span<(double X, double Y)> pt0 = stackalloc (double X, double Y)[8];
Span<(double X, double Y)> pt1 = stackalloc (double X, double Y)[8];
Span<(double X, double Y)> pt2 = stackalloc (double X, double Y)[8];
Span<(double X, double Y)> pt3 = stackalloc (double X, double Y)[8];
Span<(double X, double Y)> pt4 = stackalloc (double X, double Y)[8];

//ここから積分開始
for (int j = yMin; j < yMax; j++)
Expand Down Expand Up @@ -2785,7 +2789,10 @@ public static (double[][] Profile, double[][] Pixels) GetProfileThreadWithTiltCo
if (n4 == 0)//次のポリゴンが無かったら終了
break;

Array.Copy(pt4, pt1, n4);
//Array.Copy(pt4, pt1, n4);
for (int n = 0; i < n4; i++)
pt1[n] = pt4[n];

n1 = n4;

if (k2 == chiDivision - 1)
Expand All @@ -2795,7 +2802,10 @@ public static (double[][] Profile, double[][] Pixels) GetProfileThreadWithTiltCo

if (n2 == 0)//次のポリゴンが無かったら終了
break;
Array.Copy(pt2, pt0, n2);
//Array.Copy(pt2, pt0, n2);
for (int n = 0; i < n2; i++)
pt0[n] = pt2[n];

n0 = n2;

#region 20200430 上のコードで十分速度が出るので、お蔵入り
Expand Down Expand Up @@ -2856,7 +2866,7 @@ public static (double[][] Profile, double[][] Pixels) GetProfileThreadWithTiltCo
/// <param name="n"></param>
/// <param name="pt"></param>
/// <returns></returns>
private static double getArea(int n, (double X, double Y)[] pt)
private static double getArea(int n, Span<(double X, double Y)> pt)
{
if (n < 3) return 0;
var result = pt[0].X * (pt[1].Y - pt[n - 1].Y) + pt[n - 1].X * (pt[0].Y - pt[n - 2].Y);
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1527,9 +1527,9 @@ public static double[] ConvertToD(double[] x, HorizontalAxisProperty src)
if (src.AxisMode == HorizontalAxis.d)
{
if (src.DspacingUnit == LengthUnitEnum.Angstrom)
d = x;
else if (src.DspacingUnit == LengthUnitEnum.NanoMeter)
d = x.Select(d => d * 0.1).ToArray();
else if (src.DspacingUnit == LengthUnitEnum.NanoMeter)
d = x;
}

else if (src.AxisMode == HorizontalAxis.Angle)
Expand Down
15 changes: 14 additions & 1 deletion PDIndexer/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,9 @@ public void SetDrawRangeLimit()
}
if (double.IsInfinity(MinimalX)) return;

MinimalX = minimalX;
MinimalX = minimalX;//MinimalXが直近のMaximalXより大きかった場合、正常に更新できない。そのため、2行下でもう一回更新。
MaximalX = maximalX;
MinimalX = minimalX;//2行上のコメント参照
MinimalY = Math.Min(0, minimalY);
MaximalY = maximalY * 1.1;
}
Expand Down Expand Up @@ -3031,6 +3032,7 @@ public void AddProfileToCheckedListBox(DiffractionProfile2 dp, bool isCheked, bo
if (WaveColor != dp.SrcProperty.WaveColor) WaveColor = dp.SrcProperty.WaveColor;
if (WaveSource != dp.SrcProperty.WaveSource) WaveSource = dp.SrcProperty.WaveSource;
if (AxisMode != dp.SrcProperty.AxisMode) AxisMode = dp.SrcProperty.AxisMode;

if (WaveLength != dp.SrcProperty.WaveLength) WaveLength = dp.SrcProperty.WaveLength;
if (WaveSource == WaveSource.Xray)
{
Expand All @@ -3044,6 +3046,17 @@ public void AddProfileToCheckedListBox(DiffractionProfile2 dp, bool isCheked, bo
if (TakeoffAngle != dp.SrcProperty.EnergyTakeoffAngle) TakeoffAngle = dp.SrcProperty.EnergyTakeoffAngle;
if (TofAngle != dp.SrcProperty.TofAngle) TofAngle = dp.SrcProperty.TofAngle;
if (TofLength != dp.SrcProperty.TofLength) TofLength = dp.SrcProperty.TofLength;

if (AxisMode == HorizontalAxis.d && horizontalAxisUserControl.DspacingUnit != dp.SrcProperty.DspacingUnit)
horizontalAxisUserControl.DspacingUnit = dp.SrcProperty.DspacingUnit;
if (AxisMode == HorizontalAxis.EnergyXray || AxisMode == HorizontalAxis.EnergyElectron || AxisMode== HorizontalAxis.EnergyNeutron )
if(horizontalAxisUserControl.EnergyUnit != dp.SrcProperty.EnergyUnit)
horizontalAxisUserControl.EnergyUnit = dp.SrcProperty.EnergyUnit;

if(AxisMode== HorizontalAxis.Angle && horizontalAxisUserControl.TwoThetaUnit != dp.SrcProperty.TwoThetaUnit)
horizontalAxisUserControl.TwoThetaUnit = dp.SrcProperty.TwoThetaUnit;
if (AxisMode == HorizontalAxis.WaveNumber && horizontalAxisUserControl.WaveNumberUnit != dp.SrcProperty.WaveNumberUnit)
horizontalAxisUserControl.WaveNumberUnit = dp.SrcProperty.WaveNumberUnit;
}
dp.SetConvertedProfile(HorizontalAxisProperty);

Expand Down
4 changes: 2 additions & 2 deletions PDIndexer/PDIndexer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.11.27.1026</AssemblyVersion>
<FileVersion>2023.11.27.1026</FileVersion>
<AssemblyVersion>2023.11.27.1147</AssemblyVersion>
<FileVersion>2023.11.27.1147</FileVersion>
<ApplicationIcon>App.ico</ApplicationIcon>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions PDIndexer/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ static class Version
/// </summary>
public const string History =
"History" +
"\r\n ver4.442(2023/11/27) The target framework has been changed to .Net Desktop Runtime 8.0. Fixed a minor bug (thx to Okazaki-san)." +
"\r\n ver4.442(2023/10/07) Update crystal database. Fixed minor bugs." +
"\r\n ver4.441(2023/07/01) Fixed a bug on loading *.pdi2 format files." +
"\r\n ver4.440(2023/05/24) Improved registry read/write.The registry is cleared the first time this version is launched." +
Expand Down
Loading

0 comments on commit 85e649a

Please sign in to comment.