Skip to content

Commit

Permalink
Fixed:
Browse files Browse the repository at this point in the history
 - Poly Fitting (using of high orders)
 - Drawing of NP profiles
 - Minor errors
 - Interface fixes
Added:
 - Profile Table viewer
 - Storing auto generated tables in the project file
 - Copy structure as image (png)
 - GIU improvements
  • Loading branch information
Oleksiy Penkov committed Aug 8, 2023
1 parent 0aec17c commit 2822788
Show file tree
Hide file tree
Showing 43 changed files with 2,839 additions and 317 deletions.
9 changes: 9 additions & 0 deletions LFPSO/unit_LFPSO_Base.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
(* *****************************************************************************
*
* X-Ray Calc 3
*
* Copyright (C) 2001-2023 Oleksiy Penkov
* e-mail: [email protected]
*
****************************************************************************** *)

unit unit_LFPSO_Base;

interface
Expand Down
9 changes: 9 additions & 0 deletions LFPSO/unit_LFPSO_Periodic.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
(* *****************************************************************************
*
* X-Ray Calc 3
*
* Copyright (C) 2001-2023 Oleksiy Penkov
* e-mail: [email protected]
*
****************************************************************************** *)

unit unit_LFPSO_Periodic;

interface
Expand Down
62 changes: 46 additions & 16 deletions LFPSO/unit_LFPSO_Poly.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
(* *****************************************************************************
*
* X-Ray Calc 3
*
* Copyright (C) 2001-2023 Oleksiy Penkov
* e-mail: [email protected]
*
****************************************************************************** *)

unit unit_LFPSO_Poly;

interface
Expand Down Expand Up @@ -102,7 +111,7 @@ procedure TLFPSO_Poly.UpdatePSO(const t: integer);
procedure TLFPSO_Poly.CheckLimitsP(const i, j, k, Ord: integer);
var
Val, Max, Min: Single;
p, r: Integer;
p, r, Nmin, Nmax: Integer;
begin
for p := 0 to Ord do
begin
Expand All @@ -121,32 +130,52 @@ procedure TLFPSO_Poly.CheckLimitsP(const i, j, k, Ord: integer);
begin
for r := 1 to Counts[j] do
begin
Val := Poly(r, X[i][j][k]);
Val := Poly(r, Xmin[0][Indexes[j]][k][0], Xmax[0][Indexes[j]][k][0], X[i][j][k]);
if Val > Max then
Max := Val;
begin
Max := Val;
NMax := r;
end;
if Val < Min then
begin
Min := Val;
Nmin := r;
end;
end
end
else begin
Max := X[i][j][k][0];
Min := X[i][j][k][0];
end;

if Max > Xmax[0][Indexes[j]][k][0] then
if Max >= Xmax[0][Indexes[j]][k][0] then
begin
X[i][j][k][0] := Xmax[0][Indexes[j]][k][0];
for p := 1 to Ord do
if X[i][j][k][p] > 0 then
X[i][j][k][p] := 0;
if X[i][j][k][0] > Xmax[0][Indexes[j]][k][0] then
begin
X[i][j][k][0] := Xmax[0][Indexes[j]][k][0];
for p := 1 to Ord do
X[i][j][k][p] := 0;
end
else begin
X[i][j][k][1] := (Xmax[0][Indexes[j]][k][0] - X[i][j][k][0]) / Nmax;
for p := 2 to Ord do
X[i][j][k][p] := 0;
end;
end;

if Min < Xmin[0][Indexes[j]][k][0] then
if Min <= Xmin[0][Indexes[j]][k][0] then
begin
X[i][j][k][0] := Xmin[0][Indexes[j]][k][0];
for p := 1 to Ord do
if X[i][j][k][p] < 0 then
X[i][j][k][p] := 0;
if X[i][j][k][0] < Xmin[0][Indexes[j]][k][0] then
begin
X[i][j][k][0] := Xmin[0][Indexes[j]][k][0];
for p := 1 to Ord do
X[i][j][k][p] := 0;
end
else begin
X[i][j][k][1] := (Xmin[0][Indexes[j]][k][0] - X[i][j][k][0]) / Nmin;
for p := 2 to Ord do
X[i][j][k][p] := 0;
end;
end;
end;

Expand Down Expand Up @@ -196,15 +225,16 @@ procedure TLFPSO_Poly.XSeed;

procedure TLFPSO_Poly.RangeSeed;
var
i, j, k, p: integer;
i, j, k, p, Ord: integer;
Val: Single;
begin
for i := 0 to High(X) do // for every member of the population
begin
for j := 0 to High(X[i]) do //for every layer
for k := 1 to 3 do // for H, s, rho
begin
for p := 0 to Order(j, k) do // for every oefficient of polynome
Ord := Order(j, k);
for p := 0 to Ord do // for every oefficient of polynome
begin
if p = 0 then
begin
Expand All @@ -214,7 +244,7 @@ procedure TLFPSO_Poly.RangeSeed;
else
X[i][j][k][p] := Rand(1)/TP(p);
end;
CheckLimits(i, j, k);
CheckLimitsP(i, j, k, Ord);
end;
end;
end;
Expand Down
14 changes: 11 additions & 3 deletions LFPSO/unit_LFPSO_Regular.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
(* *****************************************************************************
*
* X-Ray Calc 3
*
* Copyright (C) 2001-2023 Oleksiy Penkov
* e-mail: [email protected]
*
****************************************************************************** *)

unit unit_LFPSO_Regular;

interface
Expand Down Expand Up @@ -171,8 +180,7 @@ procedure TLFPSO_Regular.SetStructure(const Inp: TFitStructure);
for k := 1 to Inp.Stacks[i].N do
begin
if (k = 1) and not FReInit then

InitArray(NLayers, Links);
InitArray(NLayers, Links);

for j := 0 to NLayers - 1 do
begin
Expand All @@ -193,7 +201,7 @@ procedure TLFPSO_Regular.SetStructure(const Inp: TFitStructure);

for p := 1 to 3 do
if Inp.Stacks[i].Layers[j].P[p].Paired then
Links[j][1] := Index;
Links[j][p] := Index;
end
else
for l := 1 to 3 do
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ In this version, the automatic optimization based on modified LFPSO algorithm wa

The X-Ray Calc distribution contents several demonstration projects located in the Examples folder To see the demos, click the Open button, navigate to the Examples folder, and select a project file.


2023-08-08 3.0.6
Fixed:
- Poly Fitting (using of high orders)
- Drawing of NP profiles
- Minor errors
- Interface fixes
Added:
- Profile Table viewer
- Storing auto generated tables in the project file
- Copy structure as image (png)
- GIU improvements

2023-07-31 3.0.5
Fixed:
- Poly Fitting
Expand Down
18 changes: 15 additions & 3 deletions XRC3.groupproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<Projects Include="XRayCalc3.dproj">
<Dependencies/>
</Projects>
<Projects Include="components\XRayCalcVisualControls.dproj">
<Dependencies/>
</Projects>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Default.Personality.12</Borland.Personality>
Expand All @@ -23,14 +26,23 @@
<Target Name="XRayCalc3:Make">
<MSBuild Projects="XRayCalc3.dproj" Targets="Make"/>
</Target>
<Target Name="XRayCalcVisualControls">
<MSBuild Projects="components\XRayCalcVisualControls.dproj"/>
</Target>
<Target Name="XRayCalcVisualControls:Clean">
<MSBuild Projects="components\XRayCalcVisualControls.dproj" Targets="Clean"/>
</Target>
<Target Name="XRayCalcVisualControls:Make">
<MSBuild Projects="components\XRayCalcVisualControls.dproj" Targets="Make"/>
</Target>
<Target Name="Build">
<CallTarget Targets="XRayCalc3"/>
<CallTarget Targets="XRayCalc3;XRayCalcVisualControls"/>
</Target>
<Target Name="Clean">
<CallTarget Targets="XRayCalc3:Clean"/>
<CallTarget Targets="XRayCalc3:Clean;XRayCalcVisualControls:Clean"/>
</Target>
<Target Name="Make">
<CallTarget Targets="XRayCalc3:Make"/>
<CallTarget Targets="XRayCalc3:Make;XRayCalcVisualControls:Make"/>
</Target>
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
</Project>
5 changes: 4 additions & 1 deletion XRayCalc3.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ uses
frm_Benchmark in 'forms\frm_Benchmark.pas' {frmBenchmark},
unit_files_list in 'components\unit_files_list.pas',
unit_Config in 'units\unit_Config.pas',
frm_settings in 'forms\frm_settings.pas' {frmSettings};
frm_settings in 'forms\frm_settings.pas' {frmSettings},
editor_ProfileTable in 'editors\editor_ProfileTable.pas' {edtrProfileTable},
unit_XRCGrid in 'components\unit_XRCGrid.pas';

{$R *.res}

Expand All @@ -59,5 +61,6 @@ begin
Application.CreateForm(TfrmBenchmark, frmBenchmark);
Application.CreateForm(TfrmSettings, frmSettings);
Application.CreateForm(TfrmSettings, frmSettings);
Application.CreateForm(TedtrProfileTable, edtrProfileTable);
Application.Run;
end.
13 changes: 9 additions & 4 deletions XRayCalc3.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<VerInfo_AutoGenVersion>true</VerInfo_AutoGenVersion>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=3.0.0.200;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=3.0.0.0;Comments=</VerInfo_Keys>
<Icon_MainIcon>Resources\XRayCalc3_Icon.ico</Icon_MainIcon>
<Debugger_RunParams>-f &quot;d:\DelphiProjects\X-Ray Calc\X-Ray Calc 3\test_data\Multilayer(4x20).xrcx&quot; -a</Debugger_RunParams>
<Debugger_RunParams>-f &quot;d:\DelphiProjects\X-Ray Calc\X-Ray Calc 3\test_data\Mo-B(230314B)_Poly.xrcx&quot; -a</Debugger_RunParams>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
Expand All @@ -134,9 +134,9 @@
<DCC_ImportedDataReferences>false</DCC_ImportedDataReferences>
<Icon_MainIcon>Resources\XRayCalc3_Icon.ico</Icon_MainIcon>
<VerInfo_MajorVer>3</VerInfo_MajorVer>
<VerInfo_Build>350</VerInfo_Build>
<VerInfo_Keys>CompanyName=Zhejiang University;FileDescription=$(MSBuildProjectName);FileVersion=3.0.5.350;InternalName=;LegalCopyright=Oleksiy Penkov;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=3.0.4;Comments=</VerInfo_Keys>
<VerInfo_Release>5</VerInfo_Release>
<VerInfo_Build>360</VerInfo_Build>
<VerInfo_Keys>CompanyName=Zhejiang University;FileDescription=$(MSBuildProjectName);FileVersion=3.0.6.360;InternalName=;LegalCopyright=Oleksiy Penkov;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=3.0.4;Comments=</VerInfo_Keys>
<VerInfo_Release>6</VerInfo_Release>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
Expand Down Expand Up @@ -217,6 +217,11 @@
<Form>frmSettings</Form>
<FormType>dfm</FormType>
</DCCReference>
<DCCReference Include="editors\editor_ProfileTable.pas">
<Form>edtrProfileTable</Form>
<FormType>dfm</FormType>
</DCCReference>
<DCCReference Include="components\unit_XRCGrid.pas"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
Expand Down
Loading

0 comments on commit 2822788

Please sign in to comment.