package TkFittingAppSimplest; use clib::TkFittingAppBase; @ISA = qw(TkFittingAppBase); use strict; use Sci qw($pi $kB $c $e $e0 $me $mp $mn $h $hbar $torad $todeg); use MyTk::MyDragDrop; sub CreateWidgets { my ($this, $DoSuperOnly) = @_; $this->{ProgramName} = "FittingTest(Simplest)2008"; $this->SetnSampleFiles( 1, '*.csv;*.spe;*.jel;*.asp;*.smo;*isa;*.ref;*.pal;*.bef;*.aft', ['X1', 'Y1'], [ ['E.*', '.*eV.*'], ['T.*', 'R.*', '.*signal.*', '.*'] ], ); $this->{pParameterConfigArray} = [ # VarName Value ToBeOptimized? ['bg', 1.0, 1], ['c0', 1.0, 1], ['c1', 0.0, 1], ['w0', 1.0, 1], ]; $this->SUPER::CreateWidgets(); my $DragDrop = new MyDragDrop(); $DragDrop->ConfigureDrop( $this->mw(), [ "\\.prm\$", $this->{ParameterFileFrame}->{PathEntry}, sub { $this->ReadParameterFile($_[0]); }, ], [ ".*", $this->{Sample1FileFrame}->{PathEntry}, sub { $this->{Sample1FileFrame}->{PathEntry}->SetText($_[0]); $this->ReadSampleDataFile($_[0], 1, $this->{Sample1FileFrame}, 1, 1); }, ], ); } sub CalY { my ($this, $x) = @_; my $ini = $this->{ini}; my $bg = $ini->{bg}; my $c0 = $ini->{c0}; my $c1 = $ini->{c1}; my $w0 = $ini->{w0}; #print "c=$c0,$c1,$w0,$w1\n"; return $bg + $c0 * cos($w0 * $x) + $c1 * sin($w0 * $x); } 1;