The first commit.

Enthaltene Umrechnungen:
- Leuchtkraft zu absoluter Helligkeit
- absolute Helligkeit zu Leuchtkraft
master
Martin Putzlocher 2022-02-05 21:54:26 +01:00
parent 650305be96
commit ac804b116e
19 changed files with 1268 additions and 0 deletions

BIN
astroCalc Executable file

Binary file not shown.

BIN
astroCalc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

79
astroCalc.lpi Normal file
View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<Title Value="astroCalc"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="astroCalc.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="astroCalc"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

22
astroCalc.lpr Normal file
View File

@ -0,0 +1,22 @@
program astroCalc;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

125
astroCalc.lps Normal file
View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="12"/>
<BuildModes Active="Default"/>
<Units Count="2">
<Unit0>
<Filename Value="astroCalc.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<CursorPos Y="21"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<TopLine Value="95"/>
<CursorPos X="60" Y="107"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
</Units>
<JumpHistory Count="22" HistoryIndex="21">
<Position1>
<Filename Value="unit1.pas"/>
<Caret Line="69" Column="30" TopLine="47"/>
</Position1>
<Position2>
<Filename Value="unit1.pas"/>
<Caret Line="72" Column="30" TopLine="50"/>
</Position2>
<Position3>
<Filename Value="unit1.pas"/>
<Caret Line="88" Column="3" TopLine="61"/>
</Position3>
<Position4>
<Filename Value="unit1.pas"/>
<Caret Line="52" Column="3" TopLine="50"/>
</Position4>
<Position5>
<Filename Value="unit1.pas"/>
<Caret Line="53" Column="3" TopLine="51"/>
</Position5>
<Position6>
<Filename Value="unit1.pas"/>
<Caret Line="54" Column="3" TopLine="52"/>
</Position6>
<Position7>
<Filename Value="unit1.pas"/>
<Caret Line="55" Column="3" TopLine="53"/>
</Position7>
<Position8>
<Filename Value="unit1.pas"/>
<Caret Line="56" Column="3" TopLine="54"/>
</Position8>
<Position9>
<Filename Value="unit1.pas"/>
<Caret Line="58" Column="3" TopLine="56"/>
</Position9>
<Position10>
<Filename Value="unit1.pas"/>
<Caret Line="88" Column="3" TopLine="72"/>
</Position10>
<Position11>
<Filename Value="unit1.pas"/>
<Caret Line="90" Column="3" TopLine="74"/>
</Position11>
<Position12>
<Filename Value="unit1.pas"/>
<Caret Line="106" Column="3" TopLine="75"/>
</Position12>
<Position13>
<Filename Value="unit1.pas"/>
<Caret Line="101" Column="3" TopLine="75"/>
</Position13>
<Position14>
<Filename Value="unit1.pas"/>
<Caret Line="68" Column="28" TopLine="39"/>
</Position14>
<Position15>
<Filename Value="unit1.pas"/>
<Caret Line="125" Column="23" TopLine="96"/>
</Position15>
<Position16>
<Filename Value="unit1.pas"/>
<Caret Line="124" Column="10" TopLine="97"/>
</Position16>
<Position17>
<Filename Value="unit1.pas"/>
<Caret Line="119" Column="3" TopLine="97"/>
</Position17>
<Position18>
<Filename Value="unit1.pas"/>
<Caret Line="126" Column="24" TopLine="95"/>
</Position18>
<Position19>
<Filename Value="unit1.pas"/>
<Caret Line="116" Column="6" TopLine="98"/>
</Position19>
<Position20>
<Filename Value="unit1.pas"/>
<Caret Line="112" Column="3" TopLine="95"/>
</Position20>
<Position21>
<Filename Value="astroCalc.lpr"/>
<Caret Line="21"/>
</Position21>
<Position22>
<Filename Value="unit1.pas"/>
<Caret Line="109" Column="23" TopLine="95"/>
</Position22>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

BIN
astroCalc.res Normal file

Binary file not shown.

78
backup/astroCalc.lpi Normal file
View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="astroCalc"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="astroCalc.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="astroCalc"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

125
backup/astroCalc.lps Normal file
View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="2">
<Unit0>
<Filename Value="astroCalc.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<CursorPos Y="21"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<TopLine Value="95"/>
<CursorPos X="60" Y="107"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
</Units>
<JumpHistory Count="22" HistoryIndex="21">
<Position1>
<Filename Value="unit1.pas"/>
<Caret Line="69" Column="30" TopLine="47"/>
</Position1>
<Position2>
<Filename Value="unit1.pas"/>
<Caret Line="72" Column="30" TopLine="50"/>
</Position2>
<Position3>
<Filename Value="unit1.pas"/>
<Caret Line="88" Column="3" TopLine="61"/>
</Position3>
<Position4>
<Filename Value="unit1.pas"/>
<Caret Line="52" Column="3" TopLine="50"/>
</Position4>
<Position5>
<Filename Value="unit1.pas"/>
<Caret Line="53" Column="3" TopLine="51"/>
</Position5>
<Position6>
<Filename Value="unit1.pas"/>
<Caret Line="54" Column="3" TopLine="52"/>
</Position6>
<Position7>
<Filename Value="unit1.pas"/>
<Caret Line="55" Column="3" TopLine="53"/>
</Position7>
<Position8>
<Filename Value="unit1.pas"/>
<Caret Line="56" Column="3" TopLine="54"/>
</Position8>
<Position9>
<Filename Value="unit1.pas"/>
<Caret Line="58" Column="3" TopLine="56"/>
</Position9>
<Position10>
<Filename Value="unit1.pas"/>
<Caret Line="88" Column="3" TopLine="72"/>
</Position10>
<Position11>
<Filename Value="unit1.pas"/>
<Caret Line="90" Column="3" TopLine="74"/>
</Position11>
<Position12>
<Filename Value="unit1.pas"/>
<Caret Line="106" Column="3" TopLine="75"/>
</Position12>
<Position13>
<Filename Value="unit1.pas"/>
<Caret Line="101" Column="3" TopLine="75"/>
</Position13>
<Position14>
<Filename Value="unit1.pas"/>
<Caret Line="68" Column="28" TopLine="39"/>
</Position14>
<Position15>
<Filename Value="unit1.pas"/>
<Caret Line="125" Column="23" TopLine="96"/>
</Position15>
<Position16>
<Filename Value="unit1.pas"/>
<Caret Line="124" Column="10" TopLine="97"/>
</Position16>
<Position17>
<Filename Value="unit1.pas"/>
<Caret Line="119" Column="3" TopLine="97"/>
</Position17>
<Position18>
<Filename Value="unit1.pas"/>
<Caret Line="126" Column="24" TopLine="95"/>
</Position18>
<Position19>
<Filename Value="unit1.pas"/>
<Caret Line="116" Column="6" TopLine="98"/>
</Position19>
<Position20>
<Filename Value="unit1.pas"/>
<Caret Line="112" Column="3" TopLine="95"/>
</Position20>
<Position21>
<Filename Value="astroCalc.lpr"/>
<Caret Line="21"/>
</Position21>
<Position22>
<Filename Value="unit1.pas"/>
<Caret Line="109" Column="23" TopLine="95"/>
</Position22>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

154
backup/unit1.lfm Normal file
View File

@ -0,0 +1,154 @@
object Form1: TForm1
Left = 269
Height = 240
Top = 152
Width = 320
Caption = 'Form1'
ClientHeight = 240
ClientWidth = 320
LCLVersion = '2.0.12.0'
object PageControl1: TPageControl
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 248
Top = 0
Width = 320
ActivePage = TabSheet1
Align = alCustom
Anchors = [akTop, akLeft, akRight, akBottom]
TabIndex = 1
TabOrder = 0
OnChange = PageControl1Change
object ML: TTabSheet
Caption = 'M->L'
ClientHeight = 223
ClientWidth = 320
OnContextPopup = MLContextPopup
object LabeledEdit1: TLabeledEdit
Left = 248
Height = 29
Top = 24
Width = 48
EditLabel.Height = 17
EditLabel.Width = 189
EditLabel.Caption = 'Absolute Helligkeit M = '
EditLabel.ParentColor = False
LabelPosition = lpLeft
TabOrder = 0
Text = '0'
OnChange = LabeledEdit1Change
end
object LabeledEdit2: TLabeledEdit
Left = 192
Height = 29
Top = 112
Width = 104
EditLabel.Height = 17
EditLabel.Width = 166
EditLabel.Caption = 'rel. Leuchtkraft L* = '
EditLabel.Color = clHighlightText
EditLabel.ParentColor = False
LabelPosition = lpLeft
TabOrder = 1
OnChange = LabeledEdit2Change
end
object LabeledEdit3: TLabeledEdit
Left = 136
Height = 29
Top = 152
Width = 137
EditLabel.Height = 17
EditLabel.Width = 128
EditLabel.Caption = 'Leuchtkraft L = '
EditLabel.Color = clYellow
EditLabel.ParentColor = False
LabelPosition = lpLeft
TabOrder = 2
OnChange = LabeledEdit3Change
end
object BitBtn1: TBitBtn
Left = 72
Height = 30
Top = 72
Width = 164
Caption = 'Berechne'
OnClick = BitBtn1Click
TabOrder = 3
end
object Label1: TLabel
Left = 280
Height = 17
Top = 160
Width = 16
Caption = 'W'
ParentColor = False
end
end
object TabSheet1: TTabSheet
Caption = 'L->M'
ClientHeight = 223
ClientWidth = 320
object LabeledEdit4: TLabeledEdit
Left = 192
Height = 29
Top = 16
Width = 104
EditLabel.Height = 17
EditLabel.Width = 170
EditLabel.Caption = 'Rel. Leuchtkraft L* = '
EditLabel.ParentColor = False
LabelPosition = lpLeft
TabOrder = 0
Text = '1'
OnChange = LabeledEdit4Change
OnEditingDone = LabeledEdit4EditingDone
end
object LabeledEdit5: TLabeledEdit
Left = 144
Height = 29
Top = 56
Width = 128
EditLabel.Height = 17
EditLabel.Width = 128
EditLabel.Caption = 'Leuchtkraft L = '
EditLabel.ParentColor = False
LabelPosition = lpLeft
TabOrder = 1
Text = '3.828e26'
OnChange = LabeledEdit5Change
OnEditingDone = LabeledEdit5EditingDone
end
object Label2: TLabel
Left = 280
Height = 17
Top = 64
Width = 16
Caption = 'W'
ParentColor = False
end
object Button1: TButton
Left = 80
Height = 25
Top = 104
Width = 152
Caption = 'Berechne'
OnClick = Button1Click
TabOrder = 2
end
object LabeledEdit6: TLabeledEdit
Left = 208
Height = 29
Top = 152
Width = 88
EditLabel.Height = 17
EditLabel.Width = 189
EditLabel.Caption = 'Absolute Helligkeit M = '
EditLabel.ParentColor = False
LabelPosition = lpLeft
TabOrder = 3
OnChange = LabeledEdit6Change
end
end
end
end

194
backup/unit1.pas Normal file
View File

@ -0,0 +1,194 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls,
Buttons, StdCtrls, Math, Types;
type
{ TForm1 }
TForm1 = class(TForm)
BitBtn1: TBitBtn;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
LabeledEdit1: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
LabeledEdit3: TLabeledEdit;
LabeledEdit4: TLabeledEdit;
LabeledEdit5: TLabeledEdit;
LabeledEdit6: TLabeledEdit;
PageControl1: TPageControl;
ML: TTabSheet;
TabSheet1: TTabSheet;
procedure BitBtn1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure LabeledEdit1Change(Sender: TObject);
procedure LabeledEdit2Change(Sender: TObject);
procedure LabeledEdit3Change(Sender: TObject);
procedure LabeledEdit4Change(Sender: TObject);
procedure LabeledEdit4EditingDone(Sender: TObject);
procedure LabeledEdit5Change(Sender: TObject);
procedure LabeledEdit5EditingDone(Sender: TObject);
procedure LabeledEdit6Change(Sender: TObject);
procedure MLContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure PageControl1Change(Sender: TObject);
private
function CalcAbsMFromL(L: Double): Double;
function CalcLstarFromAbsM(M: Double): Double;
function CalcLFromAbsM(M: Double): Double;
function CalcLFromLstar(Lstar: Double): Double;
function CalcLstarFromL(L: Double): Double;
public
end;
const
c = 299792458;
Msun = 4.84;
Lsun = 3.828e26;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.PageControl1Change(Sender: TObject);
begin
end;
procedure TForm1.LabeledEdit2Change(Sender: TObject);
begin
end;
procedure TForm1.LabeledEdit1Change(Sender: TObject);
begin
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var M, Lstar, L: Double;
begin
try
M := StrToFloat(LabeledEdit1.Text);
except
ShowMessage('keine Fließkommazahl');
M := 0;
end;
Lstar := CalcLstarFromAbsM(M);//Power(10, (M-Msun)/(-2.5));
L := CalcLFromLstar(Lstar);
Lstar := RoundTo(Lstar, -4);
L := RoundTo(L,23);
LabeledEdit2.Text := FloatToStr(Lstar);
LabeledEdit3.Text := FloatToStr(L);
end;
procedure TForm1.Button1Click(Sender: TObject);
var L, M: Double;
begin
try
if LabeledEdit5.Text = '' then L := Lsun
else
L := StrToFloat(LabeledEdit5.Text);
except
ShowMessage('keine Fließkommazahl');
L := Lsun;
end;
M := CalcAbsMFromL(L);
LabeledEdit6.Text := FormatFloat('#.##',M);
end;
procedure TForm1.LabeledEdit3Change(Sender: TObject);
begin
end;
procedure TForm1.LabeledEdit4Change(Sender: TObject);
begin
end;
procedure TForm1.LabeledEdit4EditingDone(Sender: TObject);
var L, Lstar: Double;
begin
try
if LabeledEdit4.Text = '' then Lstar := 1
else
Lstar := StrToFloat(LabeledEdit4.Text);
except
ShowMessage('keine Fließkommazahl');
Lstar := 1;
end;
L := CalcLFromLstar(Lstar);
LabeledEdit5.Text := FormatFloat('0.000E+00',L);
end;
procedure TForm1.LabeledEdit5Change(Sender: TObject);
begin
end;
procedure TForm1.LabeledEdit5EditingDone(Sender: TObject);
var L, Lstar: Double;
begin
try
if LabeledEdit5.Text = '' then L := Lsun
else
L := StrToFloat(LabeledEdit5.Text);
except
ShowMessage('keine Fließkommazahl');
L := Lsun;
end;
Lstar := CalcLStarFromL(L);
LabeledEdit4.Text := FormatFloat('#.##',Lstar);
end;
procedure TForm1.LabeledEdit6Change(Sender: TObject);
begin
end;
procedure TForm1.MLContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
end;
function TForm1.CalcAbsMFromL(L: Double): Double;
begin
CalcAbsMFromL := -2.5 * Log10( L / Lsun )+ Msun;
end;
function TForm1.CalcLstarFromAbsM(M: Double): Double;
begin
CalcLstarFromAbsM := Power(10, (M-Msun)/(-2.5));
end;
function TForm1.CalcLFromAbsM(M: Double): Double;
begin
CalcLFromAbsM := Lsun * Power(10, (M-Msun)/(-2.5));
end;
function TForm1.CalcLFromLstar(Lstar: Double): Double;
begin
CalcLFromLstar := Lstar * Lsun;
end;
function TForm1.CalcLstarFromL(L: Double): Double;
begin
CalcLstarFromL := L / Lsun;
end;
end.

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Compiler Value="/usr/bin/fpc" Date="1622464867"/>
<Params Value=" -MObjFPC -Scghi -Cg -O1 -g -gl -l -vewnhibq -Fi/home/mputzlocher/Nextcloud/astro/astroCalc/lib/x86_64-linux -Fu/usr/lib/lazarus/lcl/units/x86_64-linux/gtk2 -Fu/usr/lib/lazarus/lcl/units/x86_64-linux -Fu/usr/lib/lazarus/components/freetype/lib/x86_64-linux -Fu/usr/lib/lazarus/components/lazutils/lib/x86_64-linux -Fu/usr/lib/lazarus/packager/units/x86_64-linux -Fu/home/mputzlocher/Nextcloud/astro/astroCalc/ -FU/home/mputzlocher/Nextcloud/astro/astroCalc/lib/x86_64-linux/ -FE/home/mputzlocher/Nextcloud/astro/astroCalc/ -o/home/mputzlocher/Nextcloud/astro/astroCalc/astroCalc -dLCL -dLCLgtk2 astroCalc.lpr"/>
</CONFIG>

Binary file not shown.

Binary file not shown.

Binary file not shown.

146
lib/x86_64-linux/unit1.lfm Normal file
View File

@ -0,0 +1,146 @@
object Form1: TForm1
Left = 421
Height = 240
Top = 140
Width = 320
Caption = 'Form1'
ClientHeight = 240
ClientWidth = 320
LCLVersion = '2.2.0.4'
object PageControl1: TPageControl
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 248
Top = 0
Width = 320
ActivePage = TabSheet1
Align = alCustom
Anchors = [akTop, akLeft, akRight, akBottom]
TabIndex = 1
TabOrder = 0
OnChange = PageControl1Change
object ML: TTabSheet
Caption = 'M->L'
ClientHeight = 209
ClientWidth = 310
OnContextPopup = MLContextPopup
object LabeledEdit1: TLabeledEdit
Left = 248
Height = 37
Top = 24
Width = 48
EditLabel.Height = 25
EditLabel.Width = 192
EditLabel.Caption = 'Absolute Helligkeit M = '
LabelPosition = lpLeft
TabOrder = 0
Text = '0'
OnChange = LabeledEdit1Change
end
object LabeledEdit2: TLabeledEdit
Left = 192
Height = 37
Top = 112
Width = 104
EditLabel.Height = 25
EditLabel.Width = 168
EditLabel.Caption = 'rel. Leuchtkraft L* = '
EditLabel.Color = clHighlightText
LabelPosition = lpLeft
TabOrder = 1
OnChange = LabeledEdit2Change
end
object LabeledEdit3: TLabeledEdit
Left = 136
Height = 37
Top = 152
Width = 137
EditLabel.Height = 25
EditLabel.Width = 127
EditLabel.Caption = 'Leuchtkraft L = '
EditLabel.Color = clYellow
LabelPosition = lpLeft
TabOrder = 2
OnChange = LabeledEdit3Change
end
object BitBtn1: TBitBtn
Left = 72
Height = 30
Top = 72
Width = 164
Caption = 'Berechne'
OnClick = BitBtn1Click
TabOrder = 3
end
object Label1: TLabel
Left = 280
Height = 25
Top = 160
Width = 16
Caption = 'W'
end
end
object TabSheet1: TTabSheet
Caption = 'L->M'
ClientHeight = 209
ClientWidth = 310
object LabeledEdit4: TLabeledEdit
Left = 192
Height = 37
Top = 16
Width = 104
EditLabel.Height = 25
EditLabel.Width = 172
EditLabel.Caption = 'Rel. Leuchtkraft L* = '
LabelPosition = lpLeft
TabOrder = 0
Text = '1'
OnChange = LabeledEdit4Change
OnEditingDone = LabeledEdit4EditingDone
end
object LabeledEdit5: TLabeledEdit
Left = 144
Height = 37
Top = 56
Width = 128
EditLabel.Height = 25
EditLabel.Width = 127
EditLabel.Caption = 'Leuchtkraft L = '
LabelPosition = lpLeft
TabOrder = 1
Text = '3.828e26'
OnChange = LabeledEdit5Change
OnEditingDone = LabeledEdit5EditingDone
end
object Label2: TLabel
Left = 280
Height = 25
Top = 64
Width = 16
Caption = 'W'
end
object Button1: TButton
Left = 80
Height = 25
Top = 104
Width = 152
Caption = 'Berechne'
OnClick = Button1Click
TabOrder = 2
end
object LabeledEdit6: TLabeledEdit
Left = 208
Height = 37
Top = 152
Width = 88
EditLabel.Height = 25
EditLabel.Width = 192
EditLabel.Caption = 'Absolute Helligkeit M = '
LabelPosition = lpLeft
TabOrder = 3
OnChange = LabeledEdit6Change
end
end
end
end

BIN
lib/x86_64-linux/unit1.o Normal file

Binary file not shown.

BIN
lib/x86_64-linux/unit1.ppu Normal file

Binary file not shown.

146
unit1.lfm Normal file
View File

@ -0,0 +1,146 @@
object Form1: TForm1
Left = 421
Height = 240
Top = 140
Width = 320
Caption = 'Form1'
ClientHeight = 240
ClientWidth = 320
LCLVersion = '2.2.0.4'
object PageControl1: TPageControl
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 248
Top = 0
Width = 320
ActivePage = TabSheet1
Align = alCustom
Anchors = [akTop, akLeft, akRight, akBottom]
TabIndex = 1
TabOrder = 0
OnChange = PageControl1Change
object ML: TTabSheet
Caption = 'M->L'
ClientHeight = 209
ClientWidth = 310
OnContextPopup = MLContextPopup
object LabeledEdit1: TLabeledEdit
Left = 248
Height = 37
Top = 24
Width = 48
EditLabel.Height = 25
EditLabel.Width = 192
EditLabel.Caption = 'Absolute Helligkeit M = '
LabelPosition = lpLeft
TabOrder = 0
Text = '0'
OnChange = LabeledEdit1Change
end
object LabeledEdit2: TLabeledEdit
Left = 192
Height = 37
Top = 112
Width = 104
EditLabel.Height = 25
EditLabel.Width = 168
EditLabel.Caption = 'rel. Leuchtkraft L* = '
EditLabel.Color = clHighlightText
LabelPosition = lpLeft
TabOrder = 1
OnChange = LabeledEdit2Change
end
object LabeledEdit3: TLabeledEdit
Left = 136
Height = 37
Top = 152
Width = 137
EditLabel.Height = 25
EditLabel.Width = 127
EditLabel.Caption = 'Leuchtkraft L = '
EditLabel.Color = clYellow
LabelPosition = lpLeft
TabOrder = 2
OnChange = LabeledEdit3Change
end
object BitBtn1: TBitBtn
Left = 72
Height = 30
Top = 72
Width = 164
Caption = 'Berechne'
OnClick = BitBtn1Click
TabOrder = 3
end
object Label1: TLabel
Left = 280
Height = 25
Top = 160
Width = 16
Caption = 'W'
end
end
object TabSheet1: TTabSheet
Caption = 'L->M'
ClientHeight = 209
ClientWidth = 310
object LabeledEdit4: TLabeledEdit
Left = 192
Height = 37
Top = 16
Width = 104
EditLabel.Height = 25
EditLabel.Width = 172
EditLabel.Caption = 'Rel. Leuchtkraft L* = '
LabelPosition = lpLeft
TabOrder = 0
Text = '1'
OnChange = LabeledEdit4Change
OnEditingDone = LabeledEdit4EditingDone
end
object LabeledEdit5: TLabeledEdit
Left = 144
Height = 37
Top = 56
Width = 128
EditLabel.Height = 25
EditLabel.Width = 127
EditLabel.Caption = 'Leuchtkraft L = '
LabelPosition = lpLeft
TabOrder = 1
Text = '3.828e26'
OnChange = LabeledEdit5Change
OnEditingDone = LabeledEdit5EditingDone
end
object Label2: TLabel
Left = 280
Height = 25
Top = 64
Width = 16
Caption = 'W'
end
object Button1: TButton
Left = 80
Height = 25
Top = 104
Width = 152
Caption = 'Berechne'
OnClick = Button1Click
TabOrder = 2
end
object LabeledEdit6: TLabeledEdit
Left = 208
Height = 37
Top = 152
Width = 88
EditLabel.Height = 25
EditLabel.Width = 192
EditLabel.Caption = 'Absolute Helligkeit M = '
LabelPosition = lpLeft
TabOrder = 3
OnChange = LabeledEdit6Change
end
end
end
end

194
unit1.pas Normal file
View File

@ -0,0 +1,194 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls,
Buttons, StdCtrls, Math, Types;
type
{ TForm1 }
TForm1 = class(TForm)
BitBtn1: TBitBtn;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
LabeledEdit1: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
LabeledEdit3: TLabeledEdit;
LabeledEdit4: TLabeledEdit;
LabeledEdit5: TLabeledEdit;
LabeledEdit6: TLabeledEdit;
PageControl1: TPageControl;
ML: TTabSheet;
TabSheet1: TTabSheet;
procedure BitBtn1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure LabeledEdit1Change(Sender: TObject);
procedure LabeledEdit2Change(Sender: TObject);
procedure LabeledEdit3Change(Sender: TObject);
procedure LabeledEdit4Change(Sender: TObject);
procedure LabeledEdit4EditingDone(Sender: TObject);
procedure LabeledEdit5Change(Sender: TObject);
procedure LabeledEdit5EditingDone(Sender: TObject);
procedure LabeledEdit6Change(Sender: TObject);
procedure MLContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure PageControl1Change(Sender: TObject);
private
function CalcAbsMFromL(L: Double): Double;
function CalcLstarFromAbsM(M: Double): Double;
function CalcLFromAbsM(M: Double): Double;
function CalcLFromLstar(Lstar: Double): Double;
function CalcLstarFromL(L: Double): Double;
public
end;
const
c = 299792458;
Msun = 4.84;
Lsun = 3.828e26;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.PageControl1Change(Sender: TObject);
begin
end;
procedure TForm1.LabeledEdit2Change(Sender: TObject);
begin
end;
procedure TForm1.LabeledEdit1Change(Sender: TObject);
begin
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var M, Lstar, L: Double;
begin
try
M := StrToFloat(LabeledEdit1.Text);
except
ShowMessage('keine Fließkommazahl');
M := 0;
end;
Lstar := CalcLstarFromAbsM(M);//Power(10, (M-Msun)/(-2.5));
L := CalcLFromLstar(Lstar);
Lstar := RoundTo(Lstar, -4);
L := RoundTo(L,23);
LabeledEdit2.Text := FloatToStr(Lstar);
LabeledEdit3.Text := FloatToStr(L);
end;
procedure TForm1.Button1Click(Sender: TObject);
var L, M: Double;
begin
try
if LabeledEdit5.Text = '' then L := Lsun
else
L := StrToFloat(LabeledEdit5.Text);
except
ShowMessage('keine Fließkommazahl');
L := Lsun;
end;
M := CalcAbsMFromL(L);
LabeledEdit6.Text := FormatFloat('#.##',M);
end;
procedure TForm1.LabeledEdit3Change(Sender: TObject);
begin
end;
procedure TForm1.LabeledEdit4Change(Sender: TObject);
begin
end;
procedure TForm1.LabeledEdit4EditingDone(Sender: TObject);
var L, Lstar: Double;
begin
try
if LabeledEdit4.Text = '' then Lstar := 1
else
Lstar := StrToFloat(LabeledEdit4.Text);
except
ShowMessage('keine Fließkommazahl');
Lstar := 1;
end;
L := CalcLFromLstar(Lstar);
LabeledEdit5.Text := FormatFloat('0.000E+00',L);
end;
procedure TForm1.LabeledEdit5Change(Sender: TObject);
begin
end;
procedure TForm1.LabeledEdit5EditingDone(Sender: TObject);
var L, Lstar: Double;
begin
try
if LabeledEdit5.Text = '' then L := Lsun
else
L := StrToFloat(LabeledEdit5.Text);
except
ShowMessage('keine Fließkommazahl');
L := Lsun;
end;
Lstar := CalcLStarFromL(L);
LabeledEdit4.Text := FormatFloat('#.##',Lstar);
end;
procedure TForm1.LabeledEdit6Change(Sender: TObject);
begin
end;
procedure TForm1.MLContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
end;
function TForm1.CalcAbsMFromL(L: Double): Double;
begin
CalcAbsMFromL := -2.5 * Log10( L / Lsun )+ Msun;
end;
function TForm1.CalcLstarFromAbsM(M: Double): Double;
begin
CalcLstarFromAbsM := Power(10, (M-Msun)/(-2.5));
end;
function TForm1.CalcLFromAbsM(M: Double): Double;
begin
CalcLFromAbsM := Lsun * Power(10, (M-Msun)/(-2.5));
end;
function TForm1.CalcLFromLstar(Lstar: Double): Double;
begin
CalcLFromLstar := Lstar * Lsun;
end;
function TForm1.CalcLstarFromL(L: Double): Double;
begin
CalcLstarFromL := L / Lsun;
end;
end.