diff --git a/src/external/MuSRFitGUI/MSR.pm b/src/external/MuSRFitGUI/MSR.pm new file mode 100755 index 00000000..416f7a4a --- /dev/null +++ b/src/external/MuSRFitGUI/MSR.pm @@ -0,0 +1,785 @@ +#use strict; +package MSR; + +my $EMPTY=""; +my $SPACE=" "; + +my %DATADIRS = ( + "LEM", "/mnt/data/nemu/his", + "GPS", "/afs/psi.ch/project/bulkmusr/data/gps", + "LTF", "/afs/psi.ch/project/bulkmusr/data/ltf", + "Dolly", "/afs/psi.ch/project/bulkmusr/data/dolly", + "GPD", "/afs/psi.ch/project/bulkmusr/data/gpd" + ); + +my %BeamLines = ( "LEM", "MUE4", "GPS", "PIM3", "LTF", "PIM3", "Dolly", "PIE1", "GPD", "PIE1" ); + +my %Def_Format = + ( "LEM", "ROOT-NPP", "GPS", "PSI-BIN", "LTF", "PSI-BIN", "Dolly", "PSI-BIN" , "GPD", "PSI-BIN"); + +# Additions to paremeters' names +my $erradd = "d"; +my $minadd = "_min"; +my $maxadd = "_max"; + +########################################################################## +# CreateMSR +# +# Input in %All +# Required: +# $All{"FitType1/2/3"} - Function types, 3 components +# $All{"LRBF"} - Histograms, comma separated +# $All{"Tis"} +# $All{"Tfs"} +# $All{"BINS"} +# $All{"FILENAME"} +# $All{"go"} +# $All{"TITLE"} +# $All{"RunNumbers"} +# $All{"FitAsyType"} +# $All{"BeamLine"} +# $All{"YEAR"} +# +# Optional: +# $All{"Sh_$Param"} +# $All{"ltc"} +# $All{"$Param"} value, error, min, and max +# $All{"logx/y"} +# $All{"Xi/f"} +# +# Output +# $Full_T_Block - Full theory block +# @Paramcomp - Space separated list of parameters for each component +# FILENAME.msr - MSR file saved +# +########################################################################## +sub CreateMSR { + my %All = %{$_[0]}; + +# "Smart" default value of the fit parameters. + my %Defaults = ( + "Asy", "0.15", "dAsy", "0.01", + "Asy_min", "0", "Asy_max", "0", + "Alpha", "1.0", "dAlpha", "0.01", + "Alpha_min", "0", "Alpha_max", "0", + "N0", "300.0", "dN0", "0.01", + "N0_min", "0", "N0_max", "0", + "NBg", "30.0", "dNBg", "0.01", + "NBg_min", "0", "NBg_max", "0", + "Lam", "1.0", "dLam", "0.01", + "Lam_min", "0", "Lam_max", "0", + "Gam", "1.0", "dGam", "0.01", + "Gam_min", "0", "Gam_max", "0", + "Bet", "0.5", "dBet", "0.01", + "Bet_min", "0", "Bet_max", "0", + "Two", "2.0", "dTwo", "0.0", + "Two_min", "0", "Two_max", "0", + "Del", "0.1", "dDel", "0.01", + "Del_min", "0", "Del_max", "0", + "Sgm", "0.1", "dSgm", "0.01", + "Sgm_min", "0", "Sgm_max", "0", + "Aa", "0.1", "dAa", "0.01", + "Aa_min", "0", "Aa_max", "0", + "q", "0.1", "dq", "0.01", + "q_min", "0", "q_max", "0", + "Bg", "0.036", "dBg", "0.01", + "Bg_min", "0", "Bg_max", "0", + "bgrlx", "0.", "dbgrlx", "0.0", + "bgrlx_min", "0", "bgrlx_max", "0", + "Frq", "1.0", "dFrq", "1.", + "Frq_min", "0", "Frq_max", "0", + "Field", "100.0", "dField", "1.", + "Field_min", "0", "Field_max", "0", + "Energy", "14.1", "dEnergy", "0.", + "Energy_min", "0", "Energy_max", "0", + "DeadLayer", "10.", "dDeadLayer", "0.1", + "DeadLayer_min", "0", "DeadLayer_max", "0", + "Lambda", "128.1", "dLambda", "0.1", + "Lambda_min", "0", "Lambda_max", "0", + "Phi", "1.", "dPhi", "0.01", + "Phi_min", "0", "Phi_max", "0" + ); + # Start with empty array + my @FitTypes = (); + + foreach ($All{"FitType1"},$All{"FitType2"},$All{"FitType3"}) { + if ($_ ne "None") { + @FitTypes=(@FitTypes,$_); + } + } + + my @Hists = split( /,/, $All{"LRBF"} ); + my @TiVals = split( /,/, $All{"Tis"} ); + my @TfVals = split( /,/, $All{"Tfs"} ); + my @BINVals = split( /,/, $All{"BINS"} ); + my $FILENAME = $All{"FILENAME"}; + my $BeamLine = $All{"BeamLine"}; + my $YEAR = $All{"YEAR"}; + my $DATADIR = $DATADIRS{$BeamLine}; + + my $Step = $All{"go"}; + if ( $Step eq "PLOT" ) { + $FITMINTYPE = $EMPTY; + } + elsif ( $Step eq "MIGRAD" ) { + $FITMINTYPE = "MINIMIZE\nMIGRAD\nHESSE"; + } + elsif ( $Step eq "MINOS" ) { + $FITMINTYPE = "MIGRAD\nMINOS"; + } + elsif ( $Step eq "SIMPLEX" ) { + $FITMINTYPE = "SCAN\nSIMPLEX"; + } + + + # First create the THEORY Block + my ($Full_T_Block,$Paramcomp_ref)=MSR::CreateTheory(@FitTypes); + + my @Paramcomp = @$Paramcomp_ref; + + my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"}; + $TitleLine =~ s/,/:/g; + + # Fit parameters block + my $FitParaBlk = " +################################################################### +FITPARAMETER +################################################################### +# No Name Value Err Min Max "; + + # Counter for RUNS + my $iRun = 1; + + # Counter of Params + my $j = 1; + + my @RUNS=split( /,/, $All{"RunNumbers"}); + # $shcount is a counter for shared parameters + if ( $#RUNS == 0 ) { + my $shcount = 1; + } + else { + if ( $All{"Sh_Alpha"} == 1 ) { + my $shcount = 1; + } + elsif ( $All{"Sh_N0"} == 1 ) { + my $shcount = 1; + } + elsif ( $All{"Sh_NBg"} == 1 ) { + my $shcount = 1; + } + else { + my $shcount = 0; + } + } + + $shcount = 1; + my $RUN_Block = $EMPTY; + my $RUNS_Line = $EMPTY; + + # range order + my $Range_Order = 1; + foreach my $RUN (@RUNS) { +####################################################################### + # Prepare the Parameters and initial values block + my $component = 0; + my $Single_RUN = $EMPTY; + + # Prepare map line for each run + my $MAP_Line = "map "; + + # How many non-shared parameter for this RUN? + my $nonsh = 0; + + # Prepeare Alpha/N0/NBg line for the RUN block. Empty initially. + my $Alpha_Line = $EMPTY; + + # Loop over all components in the fit + foreach my $FitType (@FitTypes) { + ++$component; + my $Parameters = $Paramcomp[ $component - 1 ]; + my @Params = split( /\s+/, $Parameters ); + + # For the first component we need Alpha for Asymmetry fits + if ( $component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) { + unshift( @Params, "Alpha" ); + } + # For the first component we need No and NBg for SingleHist fits + elsif ( $component == 1 && $All{"FitAsyType"} eq "SingleHist" ) { + unshift( @Params, ( "N0", "NBg" ) ); + } + + foreach $Param (@Params) { + $Param_ORG = $Param; + if ( ($#FitTypes != 0) && ($Param ne "Alpha" && $Param ne "N0" && $Param ne "NBg" ) ) { + $Param = join( $EMPTY, $Param, "_", "$component" ); + } + + # If we have only one RUN then everything is shared + if ( $#RUNS == 0 ) { + $Shared = 1; + } + # Otherwise check input if it was marked as shared + else { + $Shared = $All{"Sh_$Param"}; + } + + # Alpha, N0 and NBg Lines + # + # If you encounter alpha in the parameters list make sure + # to fill this line for the RUN block. + if ( $Param_ORG eq "Alpha" ) { + if ($Shared) { + # If alpha is shared use always the same line + $Alpha_Line = "alpha 1\n"; + } + else { + # Otherwise modify alpha line accordingly + $Alpha_Line = "alpha $j\n"; + } + } + # If you encounter N0 in the parameters list make sure + # to fill this line for the RUN block. + elsif ( $Param_ORG eq "N0" ) { + if ($Shared) { + $Alpha_Line = "norm 1\n"; + } + else { + $Alpha_Line = "norm $j\n"; + } + + # Optional - add lifetime correction for SingleHist fits + if ( $All{"ltc"} eq "y" ) { + $Alpha_Line = $Alpha_Line . "lifetimecorrection\n"; + } + + # If you encounter NBg in the parameters list make sure + # to fill this line for the RUN block. + } + elsif ( $Param_ORG eq "NBg" ) { + if ($Shared) { + $Alpha_Line = $Alpha_Line . "backgr.fit 2\n"; + } + else { + $Alpha_Line = $Alpha_Line . "backgr.fit $j\n"; + } + } + + # End of Alpha, N0 and NBg Lines +#################################################################################################### + +#################################################################################################### + # Extract initial values, error and max/min from input + $Name = $Param . "_" . $iRun; + $value = $All{"$Name"}; + $error = $All{"$erradd$Name"}; + $minvalue = $All{"$Name$minadd"}; + $maxvalue = $All{"$Name$maxadd"}; +# If these values are not in the input then take the defaulst +# I think that this can go at the end if we use a separate initialization routine + if ($value eq $EMPTY) { + $value = $Defaults{"$Param_ORG"}; + $error = $Defaults{"$erradd$Param_ORG"}; + $minvalue = $Defaults{"$Param_ORG$minadd"}; + $maxvalue = $Defaults{"$Param_ORG$maxadd"}; + } + if ( $minvalue == $maxvalue ) { + $minvalue = $EMPTY; + $maxvalue = $EMPTY; + } +#################################################################################################### + + # Start preparing the parameters block + if ($Shared) { + + # Parameter is shared enough to keep order from first run + if ( $iRun == 1 ) { + $FitParaBlk = $FitParaBlk . " + $j $Name $value $error $error $minvalue $maxvalue"; + $Full_T_Block =~ s/$Param_ORG/$j/; + ++$shcount; + ++$j; + } + } else { + + # Parameter is not shared, use map unless it is a single RUN fit + $FitParaBlk = $FitParaBlk . " + $j $Name $value $error $error $minvalue $maxvalue"; + + # Skip adding to map line in these cases + if ( $Param ne "Alpha" + && $Param ne "N0" + && $Param ne "NBg" + && $#RUNS != 0 ) + { + ++$nonsh; + $Full_T_Block =~ s/$Param_ORG/map$nonsh/; + $MAP_Line = join( ' ', $MAP_Line, $j ); + } + ++$j; + } + $NtotPar = $j; + } + } + + # Finished preparing the FITPARAMETERS block +####################################################################### + + # For each defined range we need a block in the RUN-Block + # Also for each histogram in Single Histograms fits + # Also for Imaginaryand and Real for RRF fits + + $RUN = $RUNS[ $iRun - 1 ]; + if ( $RUN < 10 ) { $RUN = "000" . $RUN; } + elsif ( $RUN < 100 ) { $RUN = "00" . $RUN; } + elsif ( $RUN < 1000 ) { $RUN = "0" . $RUN; } + + # Get current year + ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = + localtime( time() ); + my $current_year = $year + 1900; + + # $TC="$TC
Data dir:".$DATADIRS{$BeamLine}."
"; + if ( $BeamLine eq "LEM" ) { + $RUN_File_Name = "lem" . substr( $YEAR, 2 ) . "_his_" . $RUN; + $RUNFILE = "$DATADIR/$YEAR/$RUN_File_Name"; + $RUN_Line = join( $SPACE, + "RUN", $RUNFILE, $BeamLines{$BeamLine}, "PSI", + $Def_Format{$BeamLine} ); + } + elsif ( $BeamLine eq "GPS" ) { + $RUN_File_Name = "deltat_pta_gps_" . $RUN; + if ( $YEAR == $current_year ) { + $RUNFILE = "$DATADIR/$RUN_File_Name"; + } + else { + $RUNFILE = "$DATADIR/d$YEAR/pta/$RUN_File_Name"; + } + $RUN_Line = join( $SPACE, + "RUN", $RUNFILE, $BeamLines{$BeamLine}, "PSI", + $Def_Format{$BeamLine} ); + } + elsif ( $BeamLine eq "LTF" ) { + $RUN_File_Name = "deltat_pta_ltf_" . $RUN; + if ( $YEAR == $current_year ) { + $RUNFILE = "$DATADIR/$RUN_File_Name"; + } + else { + $RUNFILE = "$DATADIR/d$YEAR/pta/$RUN_File_Name"; + } + $RUN_Line = join( $SPACE, + "RUN", $RUNFILE, $BeamLines{$BeamLine}, "PSI", + $Def_Format{$BeamLine} ); + } + elsif ( $BeamLine eq "Dolly" ) { + $RUN_File_Name = "deltat_pta_dolly_" . $RUN; + if ( $YEAR == $current_year ) { + $RUNFILE = "$DATADIR/$RUN_File_Name"; + } + else { + $RUNFILE = "$DATADIR/d$YEAR/pta/$RUN_File_Name"; + } + $RUN_Line = join( $SPACE, + "RUN", $RUNFILE, $BeamLines{$BeamLine}, "PSI", + $Def_Format{$BeamLine} ); + } + elsif ( $BeamLine eq "GPD" ) { + $RUN_File_Name = "deltat_pta_gpd_" . $RUN; + if ( $YEAR == $current_year ) { + $RUNFILE = "$DATADIR/$RUN_File_Name"; + } + else { + $RUNFILE = "$DATADIR/d$YEAR/pta/$RUN_File_Name"; + } + $RUN_Line = join( $SPACE, + "RUN", $RUNFILE, $BeamLines{$BeamLine}, "PSI", + $Def_Format{$BeamLine} ); + } + + # What kind of fit? 0 - Single Histogram, 2 - Asymmetry, 4 - RRF + if ( $All{"FitAsyType"} eq "Asymmetry" ) { + $Type_Line = "fittype 2"; + $PLT = 2; + $Hist_Lines = + "forward $Hists[0]\nbackward $Hists[1]"; + $Bg_Line = "background 66000 66500 66000 66500"; + $Data_Line = "data 3419 63000 3419 63000"; + } + elsif ( $All{"FitAsyType"} eq "SingleHist" ) { + $Type_Line = "fittype 0"; + $PLT = 0; + $Hist_Lines = "forward HIST"; + $Bg_Line = $EMPTY; + $Data_Line = "data 3419 63000"; + } + elsif ( $All{"FitAsyType"} eq "RotRF" ) { + $Type_Line = "fittype 4"; + } + + # Omit background and data lines for LTG,GPS and Dolly + if ( $BeamLine ne "LEM" ) { + $Bg_Line = "background 50 250 50 250"; + $Data_Line = +"t0 287 284\ndata 297 8000 294 8000"; + } + + # $MAP_Line = "map 0 0 0 0 0 0 0 0 0 0"; + $FRANGE_Line = "fit TINI TFIN"; + $PAC_Line = "packing BINNING"; + + if ( $All{"FitAsyType"} eq "Asymmetry" ) { + $Single_RUN = +"$RUN_Line\n$Type_Line\n$Alpha_Line$Hist_Lines\n$Bg_Line\n$Data_Line\n$MAP_Line\n$FRANGE_Line\n$PAC_Line\n\n"; + } + elsif ( $All{"FitAsyType"} eq "SingleHist" ) { + $Single_RUN = $EMPTY; + foreach my $Hist (@Hists) { + $Tmp_Hist_Line = $Hist_Lines; + $Tmp_Hist_Line =~ s/HIST/$Hist/g; + $Single_RUN = $Single_RUN + . "$RUN_Line\n$Type_Line\n$Alpha_Line$Tmp_Hist_Line\n$Data_Line\n$MAP_Line\n$FRANGE_Line\n$PAC_Line\n\n"; + } + } + + # Now add the appropriate values of fit range and packing + my $Range_Min = 8; + my $Range_Max = 0; + my $k = 0; + foreach my $Ti (@TiVals) { + my $Tf = $TfVals[$k]; + my $BIN = $BINVals[$k]; + $RUN_Block = $RUN_Block . $Single_RUN; + $RUN_Block =~ s/TINI/$Ti/g; + $RUN_Block =~ s/TFIN/$Tf/g; + $RUN_Block =~ s/BINNING/$BIN/g; + + # For multiple ranges use this + if ( $Ti < $Range_Min ) { $Range_Min = $Ti; } + if ( $Tf > $Range_Max ) { $Range_Max = $Tf; } + if ( $All{"FitAsyType"} eq "Asymmetry" ) { + $RUNS_Line = "$RUNS_Line " . $Range_Order; + } + elsif ( $All{"FitAsyType"} eq "SingleHist" ) { + $RUNS_Line = "$RUNS_Line " . $Range_Order; + } + ++$k; + ++$Range_Order; + } + + # if ($FitAsyType eq "Asymmetry") {$RUNS_Line="$RUNS_Line ".$iRun*$k;} + ++$iRun; + } + + # The number of runs is + $NRUNS = $iRun - 1; + + $Full_T_Block = " +################################################################### +THEORY +################################################################### +$Full_T_Block +"; + + $RUN_Block = + "################################################################### +$RUN_Block"; + + $COMMANDS_Block = + "################################################################### +COMMANDS +FITMINTYPE +SAVE +"; + $COMMANDS_Block =~ s/FITMINTYPE/$FITMINTYPE/g; + + # Check if log x and log y are selected + my $logxy = $EMPTY; + if ( $All{"logx"} eq "y" ) { $logxy = $logxy . "logx\n"; } + if ( $All{"logy"} eq "y" ) { $logxy = $logxy . "logy\n"; } + + # Check if a plot range is defined (i.e. different from fit) + $PRANGE_Line = "use_fit_ranges"; + if ( $All{"Xi"} != $All{"Xf"} ) { + + # if ($Yi != $Yf) { + $PRANGE_Line = "range ".$All{"Xi"}." ".$All{"Xf"}." ".$All{"Yi"}." ".$All{"Yf"}; + + # } else { + # $PRANGE_Line = "range $Xi $Xf"; + # } + } + + $PLOT_Block = + "################################################################### +PLOT $PLT +runs $RUNS_Line +$PRANGE_Line +$logxy"; + + # Don't know why but it is needed initially + $STAT_Block = + "############################################################### +STATISTIC --- 0000-00-00 00:00:00 +*** FIT DID NOT CONVERGE ***"; + + # Empty line at the end of each block + my $FullMSRFile = "$TitleLine$FitParaBlk\n$Full_T_Block\n$RUN_Block\n$COMMANDS_Block\n$PLOT_Block\n$STAT_Block\n"; + +# Open output file FILENAME.msr + open( OUTF,q{>},"$FILENAME.msr" ); + print OUTF ("$FullMSRFile"); + close(OUTF); + return($Full_T_Block,\@Paramcomp); +} + +######################## +# Createheory +######################## +sub CreateTheory { + # This subroutine requires: + # @FitTypes - the array of the types of components (summed) + + # It will return: + # $Full_T_Block - the full theory block with names of parameters + # @Paramcomp - an array of space separated list of parameters + # each member of the array is one component + + my (@FitTypes) = @_; + + # Start from this theory line for the different fitting functions + my %THEORY = ( + "asymmetry", "Asy", + "simplExpo", "Lam", + "generExpo", "Lam Bet", + "simpleGss", "Sgm", + "statGssKT", "Sgm", + "statGssKTLF", "Frq Sgm", + "dynGssKTLF", "Frq Sgm Lam", + "statExpKT", "Lam", + "statExpKTLF", "Frq Aa", + "dynExpKTLF", "Frq Aa Lam", + "combiLGKT", "Lam Sgm", + "spinGlass", "Lam gam q", + "rdAnisoHf", "Frq Lam", + "TFieldCos", "Phi Frq", + "internFld", "Alp Phi Frq LamT LamL", + "Bessel", "Phi Frq", + "internBsl", "Alp Phi Frq LamT LamL", + "abragam", "Sgm gam", + "Meissner", "Phi Energy Field DeadLayer Lambda", + "skewedGss", "Phi Frq Sgmm Sgmp" + ); + +####################################################################### + # Generate the full THEORY block + my $Full_T_Block = $EMPTY; + my $component = 0; + foreach my $FitType (@FitTypes) { + ++$component; + # Add components + if ( $component > 1 ) { + $Full_T_Block = $Full_T_Block . "\n+\n"; + } + + # For each component there is a THEORY block starting with "asymmetry" + my $T_Block = "asymmetry " . $THEORY{'asymmetry'}; + my $Parameters = $THEORY{'asymmetry'}; + + # Compose the THEORY block + # The duplicate names are changed for multiplied signals or just + # change names to match parameters list declared for the function + + # Stretch exponential + if ( $FitType eq "Stretch" ) { + $T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'generExpo'} ); + } + + # Exponential + elsif ( $FitType eq "Exponential" ) { + $T_Block = $T_Block . "\n" . "simplExpo " . $THEORY{'simplExpo'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'simplExpo'} ); + } + + # Gaussian + elsif ( $FitType eq "Gaussian" ) { + $T_Block = $T_Block . "\n" . "simpleGss " . $THEORY{'simpleGss'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'simpleGss'} ); + } + + # Exponential with 0 relaxation + elsif ( $FitType eq "Background" ) { + + # Do nothing + } + + # Oscillationg exponential + elsif ( $FitType eq "ExponentialCos" ) { + $T_Block = $T_Block . "\n" . "simplExpo " . $THEORY{'simplExpo'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'simplExpo'} ); + $T_Block = $T_Block . "\n" . "TFieldCos " . $THEORY{'TFieldCos'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'TFieldCos'} ); + } + + # Oscillationg gaussian + elsif ( $FitType eq "GaussianCos" ) { + $T_Block = $T_Block . "\n" . "simpleGss " . $THEORY{'simpleGss'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'simpleGss'} ); + $T_Block = $T_Block . "\n" . "TFieldCos " . $THEORY{'TFieldCos'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'TFieldCos'} ); + } + + # Oscillationg stretch exponential + elsif ( $FitType eq "StretchCos" ) { + $T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'generExpo'} ); + $T_Block = $T_Block . "\n" . "TFieldCos " . $THEORY{'TFieldCos'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'TFieldCos'} ); + } + + # Oscillationg Gaussian + elsif ( $FitType eq "GaussianCos" ) { + $T_Block = $T_Block . "\n" . "simpelGss " . $THEORY{'simpelGss'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'simpleGss'} ); + $T_Block = $T_Block . "\n" . "TFieldCos " . $THEORY{'TFieldCos'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'TFieldCos'} ); + } + + # Static Lorentzian KT + elsif ( $FitType eq "SLKT" ) { + $T_Block = $T_Block . "\n" . "statExpKT " . $THEORY{'statExpKT'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'statExpKT'} ); + } + + # Static Lorentzian KT LF + elsif ( $FitType eq "SLKTLF" ) { + $T_Block = + $T_Block . "\n" . "statExpKTLF " . $THEORY{'statExpKTLF'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'statExpKTLF'} ); + } + + # Dynamic Lorentzian KT LF + elsif ( $FitType eq "LDKTLF" ) { + $T_Block = $T_Block . "\n" . "dynExpKTLF " . $THEORY{'dynExpKTLF'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'dynExpKTLF'} ); + } + + # Static Gaussian KT + elsif ( $FitType eq "SGKT" ) { + $T_Block = $T_Block . "\n" . "statGssKT " . $THEORY{'statGssKT'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'statGssKT'} ); + } + + # Static Gaussian KT LF + elsif ( $FitType eq "SGKTLF" ) { + $T_Block = + $T_Block . "\n" . "statGssKTLF " . $THEORY{'statGssKTLF'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'statGssKTLF'} ); + } + + # Dynamic Gaussian KT LF + elsif ( $FitType eq "GDKTLF" ) { + $T_Block = $T_Block . "\n" . "dynGssKTLF " . $THEORY{'dynGssKTLF'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'dynGssKTLF'} ); + } + + # Now some more combined functions (multiplication). + + # Lorentzian KT LF multiplied by exponential + elsif ( $FitType eq "LLFExp" ) { + $T_Block = $T_Block . "\n" . "simplExpo " . $THEORY{'simplExpo'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'simplExpo'} ); + $T_Block = + $T_Block . "\n" . "statExpKTLF " . $THEORY{'statExpKTLF'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'statExpKTLF'} ); + } + + # Lorentzian KT LF multiplied by stretched exponential + elsif ( $FitType eq "LLFSExp" ) { + $T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'generExpo'} ); + $T_Block = + $T_Block . "\n" . "statExpKTLF " . $THEORY{'statExpKTLF'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'statExpKTLF'} ); + } + + # Gaussian KT LF multiplied by exponential + elsif ( $FitType eq "GLFExp" ) { + $T_Block = $T_Block . "\n" . "simplExpo " . $THEORY{'simplExpo'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'simplExpo'} ); + $T_Block = + $T_Block . "\n" . "statGssKTLF " . $THEORY{'statGssKTLF'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'statGssKTLF'} ); + } + + # Gaussian KT LF multiplied by stretched exponential + elsif ( $FitType eq "GLFSExp" ) { + $T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'generExpo'} ); + $T_Block = + $T_Block . "\n" . "statGssKTLF " . $THEORY{'statGssKTLF'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'statGssKTLF'} ); + } + + # Meissner state model + elsif ( $FitType eq "Meissner" ) { + $T_Block = $T_Block . "\n" . "simpleGss " . $THEORY{'simpleGss'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'simpleGss'} ); + $T_Block = + $T_Block . "\n" + . "userFcn libTFitPofB.so TLondon1DHS " + . $THEORY{'Meissner'}; + $Parameters = join( $SPACE, $Parameters, $THEORY{'Meissner'} ); + } + + $Paramcomp[ $component - 1 ] = $Parameters; + $Full_T_Block = $Full_T_Block . $T_Block; + + # Finished preparing the THEORY block +####################################################################### + } + return($Full_T_Block,\@Paramcomp); +} # End CreateTheory + +######################## +# ExtractParamBlk +######################## +sub ExtractParamBlk { +# This subroutine takes the MSR file as input and extracts the parameters +# with the corresponding values, errors etc... + +# Take the msr file as input array of lines + my @file=@_; + + my $NFITPARAMETERS=0; + my $NTHEORY=0; + my $NRUN=0; + +# Remove comment lines + @file = grep {!/^\#/} @file; +# Remove empty lines + @file = grep {/\S/} @file; + +# Identify different blocks + my $i=0; + my $line =""; + foreach $line (@file) + { + if (grep {/FITPARAMETER/} $line) {$NFITPARAMETERS=$i;} + if (grep {/THEORY/} $line) { $NTHEORY=$i;} + if ((grep {/RUN/} $line) & $NRUN==0) { $NRUN=$i;} + $i++; + } + my @FPBlock=@file[$NFITPARAMETERS+1..$NTHEORY-1]; + my @TBlock=@file[$NTHEORY+1..$NRUN-1]; + +# Split parameter's line to extract values and errors + foreach $line (@FPBlock) { + my @Param=split(/\s+/,$line); + } + + return(\@FPBlock) +} + + +1; diff --git a/src/external/MuSRFitGUI/MuSRFit.pl b/src/external/MuSRFitGUI/MuSRFit.pl new file mode 100755 index 00000000..446e367a --- /dev/null +++ b/src/external/MuSRFitGUI/MuSRFit.pl @@ -0,0 +1,1764 @@ +# Form implementation generated from reading ui file 'MuSRFit.ui' +# +# Created: Tue Aug 25 15:09:19 2009 +# by: The PerlQt User Interface Compiler (puic) +# +# WARNING! All changes made in this file will be lost! + + +use strict; +use utf8; + + +package MuSRFitform; +use Qt; +use Qt::isa qw(Qt::MainWindow); +use Qt::slots + fileNew => [], + fileOpen => [], + fileSave => [], + filePrint => [], + fileExit => [], + editUndo => [], + editRedo => [], + editCut => [], + editCopy => [], + editPaste => [], + helpIndex => [], + helpContents => [], + helpAbout => [], + CreateAllInput => [], + CallMSRCreate => [], + UpdateMSRFileInitTable => [], + ActivateShComp => [], + InitializeTab => [], + TabChanged => [], + GoFit => [], + UpdeateTable => []; +use Qt::attributes qw( + musrfit_tabs + RUNSPage + TITLELabel + TITLE + FILENAMELabel + FILENAME + RUNSLabel + RunNumbers + BeamLineLabel + BeamLine + YEARLabel + YEAR + ComponentsLabel + Comp1Label + Comp3Label + FitType2 + FitType1 + FitType3 + Comp2Label + BINS + Tfs + BINSLabel + Tis + TfsLabel + TisLabel + FitAsyTypeLabel + FitAsyType + LRBFLabel + LRBF + SharingPahe + buttonGroupSharing + SharingComp1 + ShParam_1_1 + ShParam_1_2 + ShParam_1_3 + ShParam_1_4 + ShParam_1_5 + Comp1ShLabel + SharingComp2 + Comp2ShLabel + ShParam_2_1 + ShParam_2_2 + ShParam_2_3 + ShParam_2_4 + ShParam_2_5 + SharingComp3 + Comp3ShLabel + ShParam_3_1 + ShParam_3_2 + ShParam_3_3 + ShParam_3_4 + ShParam_3_5 + InitializationPage + InitParamTable + FittingPage + textMSROutput + TabPage + Minimization + MINIMIZE + MIGRAD + SIMPLEX + ErrorCalc + HESSE + MINOS + go + FitTextOutput + MenuBar + fileMenu + editMenu + Options + helpMenu + toolBar + fileNewAction + fileOpenAction + fileSaveAction + fileSaveAsAction + filePrintAction + fileExitAction + editUndoAction + editRedoAction + editCutAction + editCopyAction + editPasteAction + editFindAction + helpContentsAction + helpIndexAction + helpAboutAction + Action + separatorAction + FileExistCheck + MaualFile +); + + +our $image0; +our $image0_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00, + 0xd3, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xb5, 0x94, 0x51, 0x0e, 0x84, + 0x20, 0x0c, 0x44, 0xa7, 0x86, 0x4b, 0xd9, 0xfb, 0x67, 0x3c, 0x16, 0xfe, + 0x50, 0xb7, 0xa9, 0x55, 0x01, 0xdd, 0x97, 0x10, 0x49, 0x83, 0x43, 0x5b, + 0x06, 0x84, 0x24, 0x22, 0xab, 0x6a, 0xb5, 0xf9, 0x46, 0xca, 0x69, 0x41, + 0x07, 0x4b, 0x0c, 0xa8, 0x13, 0xcd, 0x36, 0xea, 0xa5, 0xf8, 0x9f, 0x05, + 0x00, 0x49, 0x81, 0x13, 0x52, 0xd5, 0x3a, 0xac, 0x8a, 0x96, 0xb1, 0x65, + 0x64, 0x02, 0x56, 0xfe, 0x46, 0x8a, 0xc5, 0x46, 0xb3, 0x3e, 0xb5, 0xc2, + 0x98, 0xed, 0xed, 0xa3, 0xf0, 0x5b, 0x16, 0x55, 0xad, 0xbe, 0xf4, 0xb8, + 0xc0, 0x62, 0xa3, 0xe9, 0x2f, 0xbc, 0x11, 0x7d, 0x83, 0x64, 0x3e, 0xbe, + 0x62, 0x75, 0xd5, 0x3d, 0xd1, 0xdd, 0x63, 0x73, 0x45, 0xaf, 0x3b, 0x3e, + 0x3b, 0xbc, 0xb8, 0xe1, 0x94, 0x70, 0x76, 0x3b, 0x23, 0xdd, 0xc2, 0xde, + 0x39, 0x24, 0xc5, 0x8b, 0x67, 0x6d, 0x2a, 0x67, 0x89, 0x7b, 0x71, 0x7f, + 0x4b, 0x25, 0xdc, 0xd8, 0x48, 0xf5, 0xa3, 0xb9, 0xe4, 0xf8, 0xc6, 0x51, + 0xdd, 0x20, 0x09, 0x92, 0xc8, 0x62, 0x05, 0x68, 0x0f, 0x4f, 0x82, 0xc5, + 0x55, 0xb5, 0x1e, 0x6b, 0x92, 0xfe, 0x5a, 0x25, 0x02, 0xc0, 0xcc, 0x3b, + 0xd4, 0x0a, 0x13, 0xb9, 0x8a, 0x13, 0x3f, 0xaf, 0x17, 0xcb, 0x28, 0x66, + 0x39, 0x83, 0x3f, 0xc4, 0xdb, 0x56, 0xbc, 0xe1, 0x7f, 0xaf, 0xdb, 0x97, + 0x62, 0xde, 0xeb, 0x43, 0x8f, 0xd0, 0x08, 0x3b, 0xbf, 0x32, 0x98, 0xdf, + 0x1b, 0xba, 0x5b, 0x87, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82; + +our $image1; +our $image1_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00, + 0x7f, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xed, 0x95, 0x51, 0x0a, 0x00, + 0x21, 0x08, 0x44, 0x75, 0xd9, 0xdb, 0x04, 0x1e, 0xc0, 0xe8, 0xfa, 0x5e, + 0xcb, 0xfd, 0xda, 0x85, 0x2d, 0x4b, 0x11, 0xfa, 0x6b, 0x20, 0x28, 0xa3, + 0x57, 0x0c, 0x53, 0xa1, 0x88, 0xc0, 0x0e, 0xdd, 0x7d, 0x81, 0x99, 0x35, + 0xb2, 0x50, 0x44, 0x70, 0x35, 0x7f, 0x59, 0x45, 0x55, 0x9d, 0x36, 0x00, + 0x00, 0x22, 0x72, 0x0f, 0x60, 0x82, 0x3d, 0x11, 0x91, 0x0b, 0x1f, 0xac, + 0x88, 0xa8, 0x94, 0xf2, 0xf5, 0x99, 0x59, 0x2d, 0x5b, 0x52, 0xe0, 0x5a, + 0xeb, 0x6f, 0x6c, 0xc1, 0x53, 0xe0, 0xd6, 0xda, 0x50, 0xeb, 0xe1, 0x29, + 0x30, 0xe2, 0x32, 0x10, 0x39, 0xf0, 0x9b, 0x0c, 0x6f, 0xb3, 0x54, 0x2a, + 0x22, 0x3a, 0xe0, 0x03, 0x3e, 0xe0, 0x85, 0xcc, 0x2b, 0x1d, 0x79, 0x0b, + 0x3c, 0xe1, 0xae, 0x3f, 0x6f, 0x9b, 0x15, 0x0f, 0x6d, 0x54, 0x33, 0xaf, + 0x47, 0xa4, 0xf4, 0xc2, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82; + +our $image2; +our $image2_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00, + 0xae, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xb5, 0x94, 0x51, 0x0e, 0xc3, + 0x20, 0x0c, 0x43, 0x6d, 0xb4, 0x53, 0x71, 0xb6, 0x69, 0x1f, 0xd3, 0xce, + 0xe6, 0x6b, 0xb1, 0x8f, 0x51, 0x35, 0xa2, 0x19, 0x23, 0x5a, 0xf0, 0x4f, + 0x44, 0x2b, 0x5e, 0x2c, 0x03, 0xa1, 0x24, 0xec, 0x50, 0xd9, 0x42, 0xdd, + 0x09, 0xbe, 0x45, 0x37, 0xd4, 0x5a, 0x9b, 0x5d, 0x4b, 0xe2, 0xf8, 0x5f, + 0x12, 0x43, 0xe0, 0x63, 0x93, 0xd7, 0x48, 0x12, 0x6d, 0x53, 0x66, 0x1d, + 0x9e, 0x85, 0x4a, 0x62, 0x4a, 0xc6, 0x63, 0x3c, 0x40, 0xcf, 0xf8, 0x57, + 0x6e, 0x51, 0x28, 0x00, 0x10, 0x40, 0x6b, 0x0d, 0x00, 0xda, 0xb1, 0x04, + 0xb9, 0xc6, 0x9d, 0x19, 0xe8, 0x87, 0x77, 0x42, 0x01, 0xf6, 0x4e, 0xbc, + 0x7c, 0x8f, 0x34, 0x2f, 0xc6, 0x78, 0xb0, 0xce, 0x55, 0x3c, 0xc7, 0x6b, + 0x75, 0x2e, 0x37, 0xe3, 0x68, 0xd6, 0x9e, 0xdc, 0x8c, 0x2d, 0xf4, 0xf5, + 0x8c, 0x01, 0xef, 0x8f, 0x4f, 0x75, 0x33, 0xfe, 0x17, 0x6a, 0x1e, 0x48, + 0x2e, 0xf4, 0xe2, 0x38, 0x0b, 0x6a, 0xc0, 0xb9, 0xd0, 0xd3, 0x6a, 0x57, + 0x16, 0x14, 0x30, 0x83, 0x3e, 0x13, 0x0a, 0xac, 0xde, 0xf6, 0x2f, 0x9a, + 0xcd, 0x8a, 0xb4, 0x79, 0x3c, 0xea, 0x0d, 0x05, 0x19, 0x70, 0xcd, 0xbc, + 0x4f, 0x01, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, + 0x42, 0x60, 0x82; + +our $image3; +our $image3_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00, + 0xad, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xd5, 0x95, 0x31, 0x0e, 0x84, + 0x20, 0x10, 0x45, 0x3f, 0x86, 0x86, 0xc4, 0x82, 0xf3, 0xd0, 0xcc, 0xc5, + 0x8c, 0x85, 0xf1, 0x62, 0x34, 0x73, 0x1e, 0x0b, 0x92, 0x2d, 0x77, 0x0b, + 0x33, 0x86, 0x15, 0x0d, 0x62, 0xd0, 0x84, 0xd7, 0x10, 0x0c, 0xbe, 0x7c, + 0xc6, 0x41, 0x14, 0x33, 0xe3, 0x09, 0x34, 0x00, 0x38, 0xe7, 0xbe, 0x35, + 0xa5, 0xcc, 0xac, 0xb4, 0x4c, 0xe6, 0x69, 0x1d, 0x87, 0x11, 0xf0, 0xde, + 0x17, 0x89, 0x88, 0x68, 0x7b, 0x87, 0x88, 0x00, 0x00, 0x5d, 0xa5, 0x90, + 0x09, 0x3a, 0xbf, 0xe4, 0x18, 0x13, 0x2c, 0x3e, 0xfd, 0xb2, 0xcd, 0x25, + 0xa9, 0x90, 0x4d, 0x6c, 0x82, 0x85, 0x09, 0x36, 0x79, 0x1e, 0x4b, 0x81, + 0xb5, 0x94, 0x52, 0xce, 0x4b, 0xe2, 0xbb, 0x64, 0x4b, 0xb1, 0x4f, 0x76, + 0x95, 0xc7, 0x12, 0xb7, 0x27, 0x4e, 0x6a, 0x3c, 0x4f, 0x69, 0xeb, 0xe4, + 0x88, 0xbb, 0xe1, 0x54, 0x7c, 0xb6, 0xb0, 0x94, 0x77, 0xdb, 0x6d, 0x18, + 0xcb, 0x45, 0xfb, 0x5d, 0xde, 0x3e, 0xd2, 0xf1, 0x8f, 0xea, 0xe8, 0x9b, + 0xb4, 0xd7, 0x6e, 0xed, 0x89, 0x95, 0xdc, 0x79, 0xb5, 0xae, 0x27, 0x66, + 0x56, 0x7f, 0xe2, 0xda, 0xfc, 0x00, 0x45, 0x36, 0x2b, 0xc8, 0x71, 0x7a, + 0x5b, 0x49, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, + 0x60, 0x82; + +our $image4; +our $image4_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x02, + 0x8c, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x8d, 0x95, 0xaf, 0x7b, 0xdb, + 0x30, 0x10, 0x86, 0xdf, 0xec, 0x09, 0x38, 0x31, 0x9b, 0xc5, 0x30, 0xb0, + 0x61, 0x35, 0x0c, 0x2c, 0xf4, 0x58, 0xcb, 0x5a, 0x18, 0xb8, 0x3f, 0x61, + 0x81, 0xa3, 0x63, 0xa3, 0x85, 0x1d, 0xeb, 0xd8, 0x02, 0x0b, 0x1d, 0xd6, + 0xb0, 0x1a, 0x0a, 0xda, 0xcc, 0x62, 0x77, 0x2c, 0x03, 0xb2, 0x1d, 0xe7, + 0xd7, 0xb3, 0x8a, 0x28, 0x96, 0x2e, 0xef, 0x7d, 0xba, 0xef, 0x2c, 0x4f, + 0xca, 0xb2, 0xe4, 0xd2, 0x68, 0xdb, 0x76, 0x2f, 0x22, 0xa4, 0x69, 0x7a, + 0xb4, 0x6e, 0x66, 0x00, 0xa8, 0x2a, 0x00, 0x21, 0x04, 0x92, 0x24, 0xc1, + 0x39, 0x37, 0x19, 0xc7, 0x4d, 0x2f, 0x52, 0x01, 0x11, 0x21, 0xcf, 0xf3, + 0x01, 0x74, 0xba, 0x37, 0x12, 0x80, 0xf7, 0xfe, 0x2c, 0xe6, 0x2a, 0x18, + 0xa0, 0xaa, 0xaa, 0x33, 0xd8, 0x69, 0x22, 0x55, 0xc5, 0x39, 0xf7, 0x79, + 0xf0, 0x25, 0x80, 0x99, 0x9d, 0x25, 0xe8, 0xe7, 0x53, 0xf8, 0x97, 0x2b, + 0xdc, 0xbd, 0x99, 0x0d, 0xc1, 0xce, 0x39, 0x9c, 0x73, 0x47, 0xf5, 0xee, + 0xeb, 0x2f, 0x22, 0x67, 0xf5, 0xbd, 0xaa, 0x58, 0x55, 0x49, 0x92, 0x84, + 0xb6, 0x6d, 0x11, 0x91, 0xc1, 0xa8, 0xf1, 0xb8, 0x74, 0xfc, 0xcf, 0x28, + 0xc6, 0xcc, 0xce, 0x3a, 0x62, 0x0c, 0xed, 0x93, 0x5d, 0x32, 0xf7, 0xaa, + 0xe2, 0x5e, 0xcd, 0x25, 0xa5, 0xe3, 0x75, 0x55, 0x3d, 0xea, 0x90, 0xff, + 0x82, 0xeb, 0xba, 0x66, 0x3e, 0x9f, 0x93, 0x65, 0xd9, 0x55, 0x78, 0x6f, + 0xe4, 0x76, 0xbb, 0x25, 0x84, 0xb0, 0x17, 0x49, 0xc8, 0xb2, 0x74, 0xa8, + 0xf5, 0x11, 0x58, 0x55, 0xf7, 0xde, 0x7b, 0xaa, 0x5d, 0x85, 0x14, 0x82, + 0x88, 0x0c, 0x80, 0xd3, 0xb9, 0x57, 0xda, 0xd6, 0x2d, 0x65, 0x59, 0xd2, + 0x84, 0x86, 0x9b, 0x9b, 0x9b, 0x7d, 0x51, 0x14, 0xa4, 0x69, 0x3a, 0x99, + 0xf4, 0x6f, 0x9e, 0xaa, 0xee, 0xab, 0xca, 0x13, 0xea, 0x06, 0x35, 0x80, + 0xcb, 0x4a, 0x01, 0x9c, 0xa4, 0x08, 0x02, 0x0e, 0x7c, 0xed, 0x79, 0x7f, + 0xdf, 0xd1, 0x34, 0x35, 0xaa, 0xc6, 0x62, 0x31, 0x67, 0xb5, 0x5a, 0x45, + 0xc5, 0xbd, 0xd2, 0xe2, 0xee, 0x0e, 0x97, 0xa6, 0xa8, 0x1a, 0x98, 0x72, + 0x66, 0x8b, 0x19, 0x20, 0x94, 0x6c, 0x79, 0xe3, 0x2f, 0x4b, 0x5b, 0xb2, + 0xfc, 0xc8, 0xa9, 0xaa, 0x1d, 0xa8, 0xe1, 0x80, 0x8f, 0xf7, 0x0f, 0x7e, + 0xe9, 0x33, 0xd3, 0x08, 0x6d, 0x78, 0xf8, 0xfa, 0x40, 0x32, 0x4b, 0xae, + 0xaa, 0xec, 0x47, 0x45, 0xc5, 0x4f, 0x7e, 0xe0, 0xf1, 0xec, 0xd8, 0xf1, + 0x22, 0x2f, 0x14, 0xfe, 0x9e, 0x97, 0xf6, 0x99, 0xba, 0x0e, 0x18, 0x46, + 0xe3, 0x3d, 0xd3, 0xd0, 0x04, 0x9e, 0x9e, 0xee, 0xaf, 0xba, 0x7b, 0x3a, + 0x52, 0x52, 0xee, 0x58, 0x52, 0x22, 0x14, 0x14, 0xdc, 0xde, 0xde, 0x92, + 0x48, 0x46, 0x6b, 0x35, 0xcf, 0x2f, 0xbf, 0x09, 0x21, 0x90, 0xce, 0x52, + 0xa6, 0x06, 0x78, 0x5f, 0xc7, 0x7e, 0x34, 0x03, 0x11, 0x62, 0x8e, 0x98, + 0x48, 0x04, 0x1c, 0x2e, 0x56, 0xdc, 0x14, 0xc4, 0xf1, 0xcd, 0xbe, 0x73, + 0x8f, 0x27, 0xb3, 0x8c, 0x1d, 0x15, 0x98, 0x91, 0x66, 0x59, 0xdc, 0xef, + 0xdc, 0x99, 0xb6, 0x75, 0x8d, 0x17, 0x89, 0xf5, 0x34, 0x63, 0xf0, 0xcd, + 0x41, 0x74, 0xb1, 0x3b, 0x89, 0x33, 0x50, 0x01, 0xe2, 0x9a, 0x00, 0xde, + 0x1a, 0x8c, 0x78, 0x87, 0xf8, 0xaa, 0x1a, 0x3c, 0x71, 0x74, 0xed, 0xd6, + 0x2f, 0x58, 0x0f, 0xc4, 0x86, 0xa6, 0x50, 0xa2, 0x29, 0xb1, 0x9d, 0x87, + 0xc8, 0xa1, 0x73, 0xa4, 0xf7, 0x74, 0x34, 0x14, 0x65, 0x8a, 0x80, 0xb5, + 0xa3, 0x3f, 0x68, 0x27, 0x76, 0x1c, 0x68, 0x80, 0x28, 0xd8, 0xe9, 0x8e, + 0xc3, 0xac, 0xa5, 0x3b, 0x67, 0x7f, 0x36, 0xf2, 0x7c, 0xc9, 0x17, 0x6c, + 0xa4, 0x72, 0x10, 0xab, 0xf1, 0xd1, 0xba, 0xf9, 0x08, 0xea, 0xfa, 0xb0, + 0x0e, 0xda, 0x01, 0xbb, 0x72, 0xce, 0x66, 0x33, 0x56, 0xab, 0xa7, 0xa8, + 0xd8, 0x7b, 0xdf, 0x5b, 0x05, 0x62, 0x10, 0x04, 0x08, 0xd1, 0x39, 0xb3, + 0x88, 0x91, 0x5e, 0x95, 0x1d, 0x60, 0x1c, 0x6a, 0x8e, 0x19, 0x22, 0xb0, + 0x5e, 0xaf, 0xc9, 0xb2, 0x6c, 0x32, 0x9d, 0xcf, 0xe7, 0xbc, 0x6d, 0xde, + 0xf8, 0xb3, 0xd9, 0xa0, 0x6a, 0xc4, 0xfb, 0x47, 0x38, 0x6a, 0x3e, 0x19, + 0x3d, 0xcb, 0x01, 0x39, 0x9c, 0xb3, 0xeb, 0xa6, 0xf5, 0x7a, 0x4d, 0x9e, + 0xe7, 0x13, 0x80, 0xe1, 0x95, 0xae, 0xeb, 0x7a, 0xff, 0xfa, 0xba, 0xa1, + 0xe9, 0xbe, 0x5f, 0x8a, 0x76, 0xa6, 0x1c, 0x9c, 0x39, 0x7c, 0x35, 0x40, + 0xb5, 0x8d, 0xbf, 0x83, 0x91, 0x2f, 0x73, 0x1e, 0x1f, 0x1f, 0x59, 0x2c, + 0x16, 0xc3, 0x25, 0xf4, 0x0f, 0x01, 0x0f, 0x7c, 0xb0, 0xf1, 0xb5, 0xc3, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82; + +our $image5; +our $image5_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00, + 0x9b, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xed, 0x94, 0x3b, 0x0e, 0x80, + 0x20, 0x0c, 0x86, 0x5b, 0xe3, 0xa9, 0x18, 0x89, 0xc7, 0x32, 0x0e, 0x84, + 0x63, 0x99, 0x8e, 0xbd, 0x16, 0x4e, 0x68, 0x41, 0x79, 0x49, 0x18, 0x4c, + 0xfc, 0xc7, 0xb6, 0x7c, 0x6d, 0xe8, 0x03, 0x99, 0x19, 0x46, 0x68, 0x1a, + 0x42, 0xfd, 0xc1, 0x52, 0x73, 0x4b, 0xb0, 0x52, 0xe4, 0x9e, 0xec, 0xd6, + 0x00, 0xe8, 0x45, 0xa3, 0xb4, 0xa1, 0x9f, 0x0a, 0xa5, 0xc8, 0x31, 0x87, + 0xce, 0x12, 0x30, 0x96, 0x7c, 0x1f, 0x54, 0x1c, 0xc3, 0x63, 0x60, 0x29, + 0x31, 0xed, 0xe4, 0x7c, 0xe5, 0xb7, 0x3f, 0xf6, 0x41, 0x12, 0xca, 0xac, + 0x31, 0x05, 0x95, 0x09, 0xd7, 0xed, 0xb2, 0x3d, 0x36, 0x2f, 0x86, 0xa6, + 0x80, 0x39, 0x65, 0xa7, 0xe2, 0x2d, 0xb4, 0x08, 0xae, 0x6d, 0x5a, 0x33, + 0xb8, 0x07, 0x5e, 0xb5, 0x20, 0x25, 0xb8, 0xf7, 0x5b, 0x73, 0xd9, 0xb0, + 0xe7, 0xba, 0xd1, 0x4e, 0x4e, 0x4e, 0x82, 0xec, 0x49, 0xd7, 0x4a, 0xa7, + 0xa0, 0x00, 0x9d, 0x15, 0xe7, 0xf4, 0xbd, 0xeb, 0xf6, 0x83, 0x4f, 0x1d, + 0x17, 0x25, 0x46, 0xd1, 0x7f, 0x21, 0xbe, 0x92, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82; + +our $image6; +our $image6_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00, + 0x93, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xed, 0x94, 0x3d, 0x0e, 0x80, + 0x20, 0x0c, 0x46, 0xa9, 0xf1, 0x54, 0x8c, 0xc4, 0x63, 0x19, 0x07, 0xc2, + 0xb1, 0x48, 0xc7, 0x5e, 0x0b, 0x27, 0xb0, 0x22, 0x60, 0x83, 0xb2, 0xf1, + 0x2d, 0x24, 0xd0, 0x3e, 0xfa, 0x07, 0x40, 0x44, 0x6a, 0x84, 0x96, 0x21, + 0xd4, 0x09, 0xe6, 0x5a, 0xf3, 0x0d, 0xf4, 0x18, 0xf6, 0xa3, 0x6c, 0x4c, + 0x64, 0x40, 0x0a, 0x06, 0x3e, 0x15, 0x5a, 0x63, 0x90, 0x38, 0xd5, 0x2e, + 0xd0, 0x1a, 0x43, 0x3c, 0x4b, 0x11, 0xa3, 0xbf, 0xa0, 0x2d, 0x47, 0xbe, + 0x72, 0xbb, 0x3c, 0xa8, 0x54, 0xe3, 0x98, 0x7e, 0x2b, 0x5d, 0x22, 0x03, + 0x25, 0x58, 0x29, 0xd3, 0xae, 0xe6, 0xb5, 0x22, 0xfd, 0x04, 0xce, 0xe1, + 0xbf, 0x82, 0xdf, 0x1a, 0xdd, 0x05, 0x96, 0x4c, 0x4f, 0x02, 0x3b, 0x2b, + 0x73, 0x92, 0x8e, 0x64, 0x75, 0x8e, 0x9d, 0x55, 0xca, 0x6c, 0xf2, 0x07, + 0x91, 0xeb, 0x56, 0x0a, 0xde, 0x90, 0xda, 0xeb, 0x93, 0x0a, 0xe6, 0x7f, + 0x3c, 0xc1, 0x0f, 0x9d, 0x5b, 0xa7, 0x46, 0x08, 0x5c, 0x06, 0xe1, 0xe5, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82; + +our $image7; +our $image7_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00, + 0x9d, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xcd, 0xd4, 0x41, 0x0e, 0x80, + 0x20, 0x0c, 0x04, 0xc0, 0xd6, 0xf8, 0xaa, 0x9e, 0x79, 0x36, 0xe7, 0xfd, + 0x16, 0x9e, 0x9a, 0x20, 0x22, 0x2c, 0xa0, 0xd1, 0x5e, 0x4c, 0x34, 0x0e, + 0xed, 0xa6, 0x41, 0x01, 0xc8, 0x1b, 0xb5, 0xb5, 0x3e, 0x9a, 0x59, 0x1a, + 0x79, 0x4f, 0xc3, 0x2b, 0xf5, 0x1f, 0x98, 0x89, 0x81, 0x82, 0x6b, 0x10, + 0x00, 0x5d, 0x82, 0x19, 0x60, 0x0a, 0xf6, 0xf2, 0xae, 0xd9, 0x18, 0x44, + 0x44, 0x94, 0xd9, 0xe3, 0x1c, 0x64, 0xa7, 0xf8, 0x76, 0x2b, 0xbc, 0xcb, + 0x91, 0xcc, 0xc9, 0x8c, 0x63, 0xca, 0x9f, 0x8f, 0xc0, 0x8e, 0x79, 0xb7, + 0x66, 0x31, 0x31, 0x07, 0x74, 0xee, 0x8a, 0x98, 0x80, 0x70, 0x1a, 0x1f, + 0x08, 0x0a, 0x04, 0xed, 0xe1, 0xb7, 0x70, 0x0d, 0x2d, 0x0f, 0x68, 0xe1, + 0x55, 0xb8, 0x87, 0x32, 0xf8, 0x05, 0x66, 0xd1, 0x5e, 0x0d, 0xed, 0x31, + 0x93, 0xed, 0x14, 0x5c, 0x56, 0x6b, 0xba, 0x7d, 0xf4, 0xe7, 0xbc, 0xeb, + 0x56, 0x64, 0xd5, 0xbb, 0x22, 0x1f, 0x77, 0x36, 0x6f, 0xea, 0x12, 0x9a, + 0xa9, 0x03, 0xbb, 0x25, 0x61, 0xad, 0xb1, 0xd6, 0xf6, 0xe7, 0x00, 0x00, + 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82; + +our $image8; +our $image8_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00, + 0xd3, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xb5, 0x95, 0xb1, 0x0e, 0x83, + 0x30, 0x0c, 0x44, 0xcf, 0x88, 0xaf, 0x8a, 0x18, 0xd9, 0xf9, 0x19, 0x36, + 0xd4, 0x85, 0xaa, 0x7f, 0xd5, 0xd9, 0x9f, 0xd5, 0xeb, 0x50, 0x99, 0x46, + 0x10, 0x93, 0x10, 0x94, 0x93, 0xbc, 0x70, 0xc9, 0xf3, 0xc9, 0x49, 0x84, + 0xa8, 0x2a, 0x5a, 0xa8, 0x6b, 0x42, 0x05, 0x20, 0x00, 0x78, 0xb6, 0x40, + 0x55, 0xa5, 0x1a, 0x4c, 0xa6, 0xd9, 0x22, 0x52, 0x0d, 0xef, 0xf7, 0x10, + 0x93, 0x35, 0x23, 0x09, 0x11, 0xe1, 0x55, 0xf8, 0x06, 0xf6, 0x52, 0xd7, + 0xc2, 0xb7, 0x51, 0xa4, 0x12, 0xff, 0xbe, 0xad, 0xa7, 0x00, 0xd5, 0x31, + 0xd9, 0xac, 0x60, 0xc6, 0x2b, 0xc8, 0x87, 0xe3, 0x3f, 0x5d, 0x78, 0xf7, + 0x5f, 0x24, 0x87, 0x8a, 0x1b, 0xee, 0x3d, 0xd3, 0x30, 0x2c, 0x08, 0xe1, + 0x7d, 0x48, 0xb6, 0x81, 0x49, 0x1e, 0x2a, 0x96, 0xe7, 0x4d, 0x53, 0x1a, + 0xee, 0xde, 0x0a, 0x83, 0x79, 0xbe, 0x79, 0xf3, 0xdc, 0x01, 0xf8, 0x00, + 0x58, 0x10, 0xc2, 0x8b, 0x36, 0x96, 0xa2, 0x5b, 0x71, 0xe6, 0xdb, 0x9c, + 0x4d, 0x21, 0xbc, 0xa9, 0x3a, 0xca, 0xad, 0xc4, 0xa9, 0x43, 0xb5, 0x46, + 0xb7, 0x13, 0x7b, 0xaa, 0x4e, 0x9c, 0x6b, 0xde, 0x2c, 0x71, 0x67, 0x69, + 0xbc, 0x8a, 0x13, 0xe7, 0x2a, 0x56, 0x9f, 0x7b, 0xff, 0x76, 0x3f, 0xab, + 0x67, 0x9c, 0x53, 0xf5, 0x8c, 0xaf, 0x6c, 0x2a, 0x51, 0x11, 0x78, 0xff, + 0x08, 0x8a, 0xf6, 0xb4, 0xfa, 0x99, 0x7e, 0x01, 0xdf, 0xa4, 0x98, 0x7b, + 0x8b, 0x94, 0x35, 0x47, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82; + +our $image9; +our $image9_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00, + 0xec, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xb5, 0x95, 0x4d, 0x0e, 0x83, + 0x20, 0x10, 0x85, 0xdf, 0x98, 0x9e, 0x6a, 0x12, 0x37, 0xbd, 0x96, 0xc4, + 0x45, 0x83, 0xd7, 0xea, 0xa6, 0xc9, 0x5c, 0x6b, 0xba, 0x40, 0x2d, 0xc8, + 0x50, 0xd0, 0xd2, 0x97, 0x98, 0x09, 0x3f, 0xf3, 0xcd, 0x13, 0x04, 0x49, + 0x44, 0xf0, 0x0f, 0xdd, 0xbe, 0x0d, 0x32, 0xb3, 0x1e, 0xfb, 0x44, 0x84, + 0x5a, 0xc0, 0xb4, 0x39, 0xb6, 0x20, 0x00, 0xa0, 0x51, 0x2f, 0x15, 0x90, + 0x56, 0xb1, 0xa1, 0x15, 0x6a, 0xb5, 0x37, 0x59, 0xf9, 0x04, 0x40, 0x01, + 0xc0, 0x3f, 0x3c, 0x00, 0x07, 0xc0, 0xc3, 0xcd, 0x6e, 0x07, 0xc5, 0x2e, + 0xe3, 0xb6, 0x35, 0x3f, 0x76, 0x4e, 0x00, 0xf4, 0x38, 0x49, 0x5e, 0xf5, + 0x0d, 0xe5, 0x91, 0x33, 0x78, 0x0c, 0x1e, 0x42, 0x08, 0x83, 0x21, 0x9e, + 0x51, 0x39, 0x6f, 0xfd, 0x2a, 0x7c, 0x32, 0x89, 0x47, 0x6e, 0x04, 0xa7, + 0x79, 0x06, 0xf8, 0x33, 0x18, 0xbf, 0xde, 0xb9, 0x98, 0x6a, 0xb0, 0x2b, + 0x5f, 0x89, 0xa9, 0xd6, 0xcd, 0x2b, 0xc3, 0xdd, 0x9c, 0x27, 0xd9, 0x4a, + 0x37, 0xcf, 0x5c, 0xe3, 0xa3, 0x13, 0xd5, 0xa9, 0x88, 0x23, 0x5a, 0xa0, + 0x3a, 0x65, 0x87, 0x27, 0x5b, 0xe3, 0x12, 0x9c, 0x68, 0xc9, 0xa0, 0x71, + 0xc1, 0x00, 0x5f, 0x54, 0xe4, 0x4e, 0xcd, 0x8e, 0x6b, 0xae, 0x2d, 0x78, + 0x37, 0xc7, 0x47, 0x78, 0x17, 0xc7, 0x56, 0xd1, 0x9f, 0x1d, 0x5b, 0x05, + 0x89, 0x96, 0xbe, 0x6b, 0xdc, 0xcd, 0xb1, 0xa5, 0xdd, 0xc0, 0x7a, 0xd1, + 0x6b, 0xf9, 0xf1, 0x7a, 0x56, 0x80, 0x57, 0xaa, 0xfd, 0xf3, 0x98, 0x9f, + 0x85, 0xeb, 0xfd, 0xbb, 0xaa, 0xe0, 0xab, 0x7a, 0x03, 0x0d, 0x36, 0xe3, + 0xe7, 0x4e, 0x20, 0x86, 0xd1, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82; + +our $image10; +our $image10_data = pack 'C*', +0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x02, + 0x59, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xb5, 0x95, 0x21, 0x93, 0x1b, + 0x39, 0x10, 0x46, 0x9f, 0xb7, 0x02, 0x7a, 0x98, 0xc4, 0x2c, 0x28, 0x38, + 0xcb, 0x6c, 0xb6, 0x86, 0x03, 0x1d, 0x68, 0x96, 0x85, 0xf9, 0x5d, 0x86, + 0x81, 0x6b, 0x66, 0xc3, 0x85, 0x03, 0x3d, 0xcc, 0x03, 0x05, 0x35, 0x4c, + 0x62, 0xdd, 0x6c, 0x02, 0x1c, 0x57, 0x6d, 0x2e, 0x97, 0xf3, 0xa6, 0x72, + 0xfb, 0x21, 0xa9, 0x4b, 0xf5, 0xf4, 0x49, 0xad, 0x6e, 0x2d, 0xfa, 0xbe, + 0xe7, 0x23, 0xf4, 0xf0, 0x21, 0x54, 0xe0, 0xd3, 0xdb, 0x49, 0x29, 0x65, + 0x4e, 0x29, 0x91, 0x73, 0xa6, 0x9a, 0x01, 0xe0, 0x44, 0x88, 0x31, 0x12, + 0x63, 0xa4, 0x69, 0x9a, 0xc5, 0x1f, 0x83, 0x73, 0xce, 0x73, 0x7f, 0x3e, + 0xe3, 0x63, 0x60, 0xbd, 0xfb, 0x0c, 0x4e, 0xae, 0xf1, 0x94, 0x18, 0x5e, + 0xcf, 0xa4, 0x94, 0xd8, 0x6c, 0x36, 0xb3, 0xf7, 0xfe, 0x5d, 0xf0, 0x45, + 0xdf, 0xf7, 0xe4, 0x9c, 0xe7, 0x97, 0x97, 0x17, 0x36, 0x9f, 0x3b, 0x36, + 0x5f, 0x76, 0x00, 0x98, 0x19, 0x6a, 0x8a, 0x61, 0x54, 0xab, 0xf4, 0xdf, + 0x8e, 0x48, 0x36, 0xb6, 0xdb, 0xed, 0xbb, 0x9c, 0x3f, 0xa8, 0xea, 0xdc, + 0x9f, 0x7b, 0xba, 0xaf, 0xcf, 0xb4, 0xdb, 0x0e, 0x33, 0xc3, 0x92, 0xa0, + 0x69, 0x09, 0x63, 0xa0, 0xf6, 0x42, 0xc9, 0x85, 0x76, 0xdb, 0x41, 0xf0, + 0x0c, 0xc3, 0xf0, 0xae, 0xab, 0x78, 0x48, 0x29, 0xe1, 0x63, 0x64, 0xd3, + 0x75, 0x00, 0x48, 0x5e, 0x52, 0x52, 0x66, 0xb2, 0x81, 0x49, 0x46, 0xc4, + 0x3c, 0xd2, 0x47, 0xac, 0x56, 0xe2, 0xa6, 0x65, 0x4c, 0x89, 0x52, 0xca, + 0x7c, 0x1f, 0x3c, 0x4d, 0xb4, 0x9b, 0x35, 0x86, 0x61, 0x05, 0xd2, 0x98, + 0x48, 0x7e, 0x44, 0x43, 0x21, 0x93, 0x30, 0x29, 0x34, 0x08, 0x96, 0x0d, + 0x44, 0x90, 0xe0, 0xc8, 0x39, 0xdf, 0x77, 0x6c, 0xaa, 0x38, 0xef, 0x28, + 0x56, 0xc8, 0xcd, 0x44, 0x59, 0x4f, 0x88, 0x13, 0xac, 0x18, 0x8e, 0x08, + 0x78, 0x52, 0x1d, 0x51, 0xa7, 0x60, 0x20, 0xae, 0x61, 0x9a, 0xa6, 0xbb, + 0xe0, 0x4f, 0x00, 0x55, 0x0d, 0x11, 0x40, 0x15, 0x03, 0x30, 0x43, 0x72, + 0xa4, 0xb1, 0x40, 0x4e, 0x3d, 0xda, 0x26, 0xc0, 0x63, 0xa5, 0x02, 0x02, + 0xd7, 0x55, 0xff, 0xed, 0x18, 0x0c, 0xcc, 0xae, 0x49, 0xb3, 0xdb, 0x18, + 0x1a, 0x13, 0xf2, 0x78, 0xa6, 0xb4, 0x19, 0x82, 0x80, 0x29, 0x26, 0x60, + 0xb5, 0x20, 0x22, 0xf7, 0xc1, 0xc1, 0x07, 0x52, 0x4a, 0x98, 0x5e, 0x81, + 0x56, 0x0d, 0xc3, 0xc8, 0x96, 0xb0, 0x50, 0x31, 0xc0, 0xca, 0x35, 0xa6, + 0x55, 0x29, 0xa5, 0x12, 0x63, 0xbc, 0x0f, 0x8e, 0x31, 0x92, 0xfb, 0x0b, + 0x5a, 0x15, 0xb3, 0x7a, 0x05, 0x14, 0x43, 0xcc, 0x43, 0x12, 0x6a, 0xad, + 0xfc, 0x38, 0x08, 0x35, 0x4f, 0x04, 0x04, 0xe7, 0xdc, 0x3b, 0x1c, 0x87, + 0xb0, 0x08, 0xde, 0x33, 0xbc, 0xbe, 0xa2, 0x80, 0x2a, 0x80, 0x92, 0x38, + 0x53, 0xdc, 0x88, 0x13, 0xa1, 0x94, 0x4a, 0x29, 0x15, 0x1b, 0x12, 0x6d, + 0xdb, 0xe2, 0x83, 0x27, 0xe7, 0x3c, 0xab, 0xea, 0x6f, 0x9f, 0xdd, 0x03, + 0xc0, 0x6a, 0xb5, 0xc2, 0x15, 0xa8, 0xc7, 0x33, 0x8d, 0x29, 0x8d, 0x35, + 0xf8, 0x65, 0x83, 0x44, 0x87, 0x18, 0x04, 0x03, 0x5e, 0x2f, 0x3c, 0x3d, + 0x3d, 0xf1, 0xf8, 0xf8, 0xb8, 0x48, 0x63, 0xe2, 0x74, 0x3a, 0xb1, 0xdf, + 0xef, 0xc9, 0x39, 0xff, 0x2b, 0x7c, 0x71, 0x6b, 0x9b, 0xaa, 0x3a, 0x0f, + 0xc3, 0xc0, 0x98, 0x12, 0xe2, 0x04, 0x9a, 0x6b, 0x82, 0xac, 0x54, 0xc4, + 0xa0, 0xeb, 0x3a, 0x42, 0x08, 0xb7, 0x52, 0x9e, 0x8f, 0xc7, 0x23, 0x87, + 0xc3, 0x01, 0xe7, 0x1c, 0xbb, 0xdd, 0x8e, 0xd5, 0x6a, 0xf5, 0x53, 0xa9, + 0x2f, 0xfe, 0xd9, 0x8f, 0x4b, 0x29, 0x73, 0xce, 0x99, 0x5a, 0x2b, 0x22, + 0x82, 0xf7, 0xfe, 0x96, 0xac, 0x5f, 0xfa, 0x43, 0x4a, 0x69, 0xfe, 0xe1, + 0x9a, 0xae, 0xeb, 0x7e, 0xda, 0xfc, 0x17, 0xf0, 0x9f, 0x4a, 0x55, 0xe7, + 0xd3, 0xe9, 0xc4, 0xe1, 0x70, 0x60, 0xb9, 0x5c, 0xf2, 0xfc, 0xfc, 0xcc, + 0x7a, 0xbd, 0x5e, 0xfc, 0x35, 0xf8, 0xa6, 0xcb, 0xe5, 0x32, 0xef, 0xf7, + 0x7b, 0xa6, 0x69, 0x62, 0xbb, 0xdd, 0xfe, 0xbd, 0xe3, 0xb7, 0x2a, 0xa5, + 0xcc, 0x87, 0xc3, 0x01, 0x55, 0xfd, 0x7f, 0xc1, 0x6f, 0xf5, 0x61, 0x7f, + 0xde, 0x77, 0x3b, 0x42, 0x7a, 0x02, 0x0f, 0x23, 0xb1, 0x5a, 0x00, 0x00, + 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82; + + +sub NEW +{ + shift->SUPER::NEW(@_[0..2]); + statusBar(); + + $image0 = Qt::Pixmap(); + $image0->loadFromData($image0_data, length ($image0_data), "PNG"); + $image1 = Qt::Pixmap(); + $image1->loadFromData($image1_data, length ($image1_data), "PNG"); + $image2 = Qt::Pixmap(); + $image2->loadFromData($image2_data, length ($image2_data), "PNG"); + $image3 = Qt::Pixmap(); + $image3->loadFromData($image3_data, length ($image3_data), "PNG"); + $image4 = Qt::Pixmap(); + $image4->loadFromData($image4_data, length ($image4_data), "PNG"); + $image5 = Qt::Pixmap(); + $image5->loadFromData($image5_data, length ($image5_data), "PNG"); + $image6 = Qt::Pixmap(); + $image6->loadFromData($image6_data, length ($image6_data), "PNG"); + $image7 = Qt::Pixmap(); + $image7->loadFromData($image7_data, length ($image7_data), "PNG"); + $image8 = Qt::Pixmap(); + $image8->loadFromData($image8_data, length ($image8_data), "PNG"); + $image9 = Qt::Pixmap(); + $image9->loadFromData($image9_data, length ($image9_data), "PNG"); + $image10 = Qt::Pixmap(); + $image10->loadFromData($image10_data, length ($image10_data), "PNG"); + + if ( name() eq "unnamed" ) + { + setName("MuSRFitform" ); + } + setSizePolicy(Qt::SizePolicy(7, 7, 1, 1, this->sizePolicy()->hasHeightForWidth()) ); + setMinimumSize(Qt::Size(21, 227) ); + setIcon($image0 ); + + setCentralWidget(Qt::Widget(this, "qt_central_widget")); + + musrfit_tabs = Qt::TabWidget(centralWidget(), "musrfit_tabs"); + musrfit_tabs->setEnabled( 1 ); + musrfit_tabs->setGeometry( Qt::Rect(5, 0, 560, 400) ); + musrfit_tabs->setSizePolicy( Qt::SizePolicy(7, 7, 1, 1, musrfit_tabs->sizePolicy()->hasHeightForWidth()) ); + musrfit_tabs->setMinimumSize( Qt::Size(560, 400) ); + musrfit_tabs->setMaximumSize( Qt::Size(32767, 32767) ); + + RUNSPage = Qt::Widget(musrfit_tabs, "RUNSPage"); + + my $LayoutWidget = Qt::Widget(RUNSPage, '$LayoutWidget'); + $LayoutWidget->setGeometry( Qt::Rect(5, 1, 545, 360) ); + my $layout24 = Qt::VBoxLayout($LayoutWidget, 11, 6, '$layout24'); + + TITLELabel = Qt::Label($LayoutWidget, "TITLELabel"); + TITLELabel->setSizePolicy( Qt::SizePolicy(5, 5, 0, 0, TITLELabel->sizePolicy()->hasHeightForWidth()) ); + $layout24->addWidget(TITLELabel); + + TITLE = Qt::LineEdit($LayoutWidget, "TITLE"); + TITLE->setSizePolicy( Qt::SizePolicy(5, 0, 1, 1, TITLE->sizePolicy()->hasHeightForWidth()) ); + $layout24->addWidget(TITLE); + + my $layout17 = Qt::HBoxLayout(undef, 0, 6, '$layout17'); + + FILENAMELabel = Qt::Label($LayoutWidget, "FILENAMELabel"); + $layout17->addWidget(FILENAMELabel); + + FILENAME = Qt::LineEdit($LayoutWidget, "FILENAME"); + FILENAME->setSizePolicy( Qt::SizePolicy(5, 0, 0, 0, FILENAME->sizePolicy()->hasHeightForWidth()) ); + $layout17->addWidget(FILENAME); + $layout24->addLayout($layout17); + + my $layout16 = Qt::HBoxLayout(undef, 0, 6, '$layout16'); + + RUNSLabel = Qt::Label($LayoutWidget, "RUNSLabel"); + $layout16->addWidget(RUNSLabel); + + RunNumbers = Qt::LineEdit($LayoutWidget, "RunNumbers"); + RunNumbers->setSizePolicy( Qt::SizePolicy(5, 0, 0, 0, RunNumbers->sizePolicy()->hasHeightForWidth()) ); + $layout16->addWidget(RunNumbers); + $layout24->addLayout($layout16); + + my $layout18 = Qt::HBoxLayout(undef, 0, 6, '$layout18'); + + BeamLineLabel = Qt::Label($LayoutWidget, "BeamLineLabel"); + $layout18->addWidget(BeamLineLabel); + + BeamLine = Qt::ComboBox(0, $LayoutWidget, "BeamLine"); + $layout18->addWidget(BeamLine); + + YEARLabel = Qt::Label($LayoutWidget, "YEARLabel"); + $layout18->addWidget(YEARLabel); + + YEAR = Qt::ComboBox(0, $LayoutWidget, "YEAR"); + $layout18->addWidget(YEAR); + $layout24->addLayout($layout18); + + ComponentsLabel = Qt::Label($LayoutWidget, "ComponentsLabel"); + $layout24->addWidget(ComponentsLabel); + + my $layout19 = Qt::GridLayout(undef, 1, 1, 0, 6, '$layout19'); + + Comp1Label = Qt::Label($LayoutWidget, "Comp1Label"); + + $layout19->addWidget(Comp1Label, 0, 0); + + Comp3Label = Qt::Label($LayoutWidget, "Comp3Label"); + + $layout19->addWidget(Comp3Label, 0, 2); + + FitType2 = Qt::ComboBox(0, $LayoutWidget, "FitType2"); + FitType2->setSizePolicy( Qt::SizePolicy(5, 0, 0, 0, FitType2->sizePolicy()->hasHeightForWidth()) ); + + $layout19->addWidget(FitType2, 1, 1); + + FitType1 = Qt::ComboBox(0, $LayoutWidget, "FitType1"); + FitType1->setSizePolicy( Qt::SizePolicy(5, 0, 0, 0, FitType1->sizePolicy()->hasHeightForWidth()) ); + FitType1->setSizeLimit( int(20) ); + FitType1->setAutoCompletion( 0 ); + FitType1->setDuplicatesEnabled( 0 ); + + $layout19->addWidget(FitType1, 1, 0); + + FitType3 = Qt::ComboBox(0, $LayoutWidget, "FitType3"); + FitType3->setSizePolicy( Qt::SizePolicy(5, 0, 0, 0, FitType3->sizePolicy()->hasHeightForWidth()) ); + + $layout19->addWidget(FitType3, 1, 2); + + Comp2Label = Qt::Label($LayoutWidget, "Comp2Label"); + + $layout19->addWidget(Comp2Label, 0, 1); + $layout24->addLayout($layout19); + + my $layout20 = Qt::GridLayout(undef, 1, 1, 0, 6, '$layout20'); + + BINS = Qt::LineEdit($LayoutWidget, "BINS"); + BINS->setSizePolicy( Qt::SizePolicy(5, 0, 0, 0, BINS->sizePolicy()->hasHeightForWidth()) ); + + $layout20->addWidget(BINS, 1, 2); + + Tfs = Qt::LineEdit($LayoutWidget, "Tfs"); + Tfs->setSizePolicy( Qt::SizePolicy(5, 0, 0, 0, Tfs->sizePolicy()->hasHeightForWidth()) ); + + $layout20->addWidget(Tfs, 1, 1); + + BINSLabel = Qt::Label($LayoutWidget, "BINSLabel"); + + $layout20->addWidget(BINSLabel, 0, 2); + + Tis = Qt::LineEdit($LayoutWidget, "Tis"); + Tis->setSizePolicy( Qt::SizePolicy(5, 0, 0, 0, Tis->sizePolicy()->hasHeightForWidth()) ); + + $layout20->addWidget(Tis, 1, 0); + + TfsLabel = Qt::Label($LayoutWidget, "TfsLabel"); + + $layout20->addWidget(TfsLabel, 0, 1); + + TisLabel = Qt::Label($LayoutWidget, "TisLabel"); + + $layout20->addWidget(TisLabel, 0, 0); + $layout24->addLayout($layout20); + + my $layout23 = Qt::HBoxLayout(undef, 0, 6, '$layout23'); + + FitAsyTypeLabel = Qt::Label($LayoutWidget, "FitAsyTypeLabel"); + $layout23->addWidget(FitAsyTypeLabel); + + FitAsyType = Qt::ComboBox(0, $LayoutWidget, "FitAsyType"); + $layout23->addWidget(FitAsyType); + + LRBFLabel = Qt::Label($LayoutWidget, "LRBFLabel"); + $layout23->addWidget(LRBFLabel); + + LRBF = Qt::LineEdit($LayoutWidget, "LRBF"); + LRBF->setSizePolicy( Qt::SizePolicy(5, 0, 0, 0, LRBF->sizePolicy()->hasHeightForWidth()) ); + $layout23->addWidget(LRBF); + $layout24->addLayout($layout23); + musrfit_tabs->insertTab( RUNSPage, "" ); + + SharingPahe = Qt::Widget(musrfit_tabs, "SharingPahe"); + + buttonGroupSharing = Qt::ButtonGroup(SharingPahe, "buttonGroupSharing"); + buttonGroupSharing->setGeometry( Qt::Rect(0, 0, 550, 400) ); + buttonGroupSharing->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, buttonGroupSharing->sizePolicy()->hasHeightForWidth()) ); + buttonGroupSharing->setAlignment( int(&Qt::ButtonGroup::AlignLeft) ); + buttonGroupSharing->setCheckable( 0 ); + + my $LayoutWidget_2 = Qt::Widget(buttonGroupSharing, '$LayoutWidget_2'); + $LayoutWidget_2->setGeometry( Qt::Rect(30, 50, 500, 311) ); + my $layoutShComp = Qt::HBoxLayout($LayoutWidget_2, 11, 6, '$layoutShComp'); + + SharingComp1 = Qt::ButtonGroup($LayoutWidget_2, "SharingComp1"); + SharingComp1->setEnabled( 0 ); + SharingComp1->setSizePolicy( Qt::SizePolicy(5, 3, 0, 0, SharingComp1->sizePolicy()->hasHeightForWidth()) ); + SharingComp1->setAlignment( int(&Qt::ButtonGroup::AlignLeft) ); + + my $LayoutWidget_3 = Qt::Widget(SharingComp1, '$LayoutWidget_3'); + $LayoutWidget_3->setGeometry( Qt::Rect(30, 70, 81, 190) ); + my $layoutComp1 = Qt::VBoxLayout($LayoutWidget_3, 11, 6, '$layoutComp1'); + + ShParam_1_1 = Qt::CheckBox($LayoutWidget_3, "ShParam_1_1"); + $layoutComp1->addWidget(ShParam_1_1); + + ShParam_1_2 = Qt::CheckBox($LayoutWidget_3, "ShParam_1_2"); + $layoutComp1->addWidget(ShParam_1_2); + + ShParam_1_3 = Qt::CheckBox($LayoutWidget_3, "ShParam_1_3"); + $layoutComp1->addWidget(ShParam_1_3); + + ShParam_1_4 = Qt::CheckBox($LayoutWidget_3, "ShParam_1_4"); + $layoutComp1->addWidget(ShParam_1_4); + + ShParam_1_5 = Qt::CheckBox($LayoutWidget_3, "ShParam_1_5"); + ShParam_1_5->setEnabled( 0 ); + ShParam_1_5->setPaletteBackgroundColor( Qt::Color(234, 233, 232) ); + ShParam_1_5->setTristate( 0 ); + $layoutComp1->addWidget(ShParam_1_5); + + Comp1ShLabel = Qt::Label(SharingComp1, "Comp1ShLabel"); + Comp1ShLabel->setGeometry( Qt::Rect(2, 30, 185, 20) ); + Comp1ShLabel->setPaletteBackgroundColor( Qt::Color(255, 255, 127) ); + $layoutShComp->addWidget(SharingComp1); + + SharingComp2 = Qt::ButtonGroup($LayoutWidget_2, "SharingComp2"); + SharingComp2->setEnabled( 0 ); + SharingComp2->setSizePolicy( Qt::SizePolicy(5, 3, 0, 0, SharingComp2->sizePolicy()->hasHeightForWidth()) ); + + Comp2ShLabel = Qt::Label(SharingComp2, "Comp2ShLabel"); + Comp2ShLabel->setGeometry( Qt::Rect(2, 30, 185, 20) ); + Comp2ShLabel->setPaletteBackgroundColor( Qt::Color(255, 255, 127) ); + + my $LayoutWidget_4 = Qt::Widget(SharingComp2, '$LayoutWidget_4'); + $LayoutWidget_4->setGeometry( Qt::Rect(20, 70, 81, 190) ); + my $layoutComp2 = Qt::VBoxLayout($LayoutWidget_4, 11, 6, '$layoutComp2'); + + ShParam_2_1 = Qt::CheckBox($LayoutWidget_4, "ShParam_2_1"); + $layoutComp2->addWidget(ShParam_2_1); + + ShParam_2_2 = Qt::CheckBox($LayoutWidget_4, "ShParam_2_2"); + $layoutComp2->addWidget(ShParam_2_2); + + ShParam_2_3 = Qt::CheckBox($LayoutWidget_4, "ShParam_2_3"); + $layoutComp2->addWidget(ShParam_2_3); + + ShParam_2_4 = Qt::CheckBox($LayoutWidget_4, "ShParam_2_4"); + $layoutComp2->addWidget(ShParam_2_4); + + ShParam_2_5 = Qt::CheckBox($LayoutWidget_4, "ShParam_2_5"); + $layoutComp2->addWidget(ShParam_2_5); + $layoutShComp->addWidget(SharingComp2); + + SharingComp3 = Qt::ButtonGroup($LayoutWidget_2, "SharingComp3"); + SharingComp3->setEnabled( 0 ); + SharingComp3->setSizePolicy( Qt::SizePolicy(5, 3, 0, 0, SharingComp3->sizePolicy()->hasHeightForWidth()) ); + SharingComp3->setAlignment( int(&Qt::ButtonGroup::AlignJustify | &Qt::ButtonGroup::AlignVCenter) ); + + Comp3ShLabel = Qt::Label(SharingComp3, "Comp3ShLabel"); + Comp3ShLabel->setGeometry( Qt::Rect(2, 30, 185, 20) ); + Comp3ShLabel->setPaletteBackgroundColor( Qt::Color(255, 255, 127) ); + + my $LayoutWidget_5 = Qt::Widget(SharingComp3, '$LayoutWidget_5'); + $LayoutWidget_5->setGeometry( Qt::Rect(30, 70, 81, 190) ); + my $layoutComp3 = Qt::VBoxLayout($LayoutWidget_5, 11, 6, '$layoutComp3'); + + ShParam_3_1 = Qt::CheckBox($LayoutWidget_5, "ShParam_3_1"); + $layoutComp3->addWidget(ShParam_3_1); + + ShParam_3_2 = Qt::CheckBox($LayoutWidget_5, "ShParam_3_2"); + $layoutComp3->addWidget(ShParam_3_2); + + ShParam_3_3 = Qt::CheckBox($LayoutWidget_5, "ShParam_3_3"); + $layoutComp3->addWidget(ShParam_3_3); + + ShParam_3_4 = Qt::CheckBox($LayoutWidget_5, "ShParam_3_4"); + $layoutComp3->addWidget(ShParam_3_4); + + ShParam_3_5 = Qt::CheckBox($LayoutWidget_5, "ShParam_3_5"); + $layoutComp3->addWidget(ShParam_3_5); + $layoutShComp->addWidget(SharingComp3); + musrfit_tabs->insertTab( SharingPahe, "" ); + + InitializationPage = Qt::Widget(musrfit_tabs, "InitializationPage"); + + InitParamTable = Qt::Table(InitializationPage, "InitParamTable"); + InitParamTable->setNumCols(InitParamTable->numCols() + 1); + InitParamTable->horizontalHeader()->setLabel(InitParamTable->numCols() - 1, trUtf8("Value")); + InitParamTable->setNumCols(InitParamTable->numCols() + 1); + InitParamTable->horizontalHeader()->setLabel(InitParamTable->numCols() - 1, trUtf8("Error")); + InitParamTable->setNumCols(InitParamTable->numCols() + 1); + InitParamTable->horizontalHeader()->setLabel(InitParamTable->numCols() - 1, trUtf8("Min")); + InitParamTable->setNumCols(InitParamTable->numCols() + 1); + InitParamTable->horizontalHeader()->setLabel(InitParamTable->numCols() - 1, trUtf8("Max")); + InitParamTable->setGeometry( Qt::Rect(5, 0, 545, 560) ); + InitParamTable->setSizePolicy( Qt::SizePolicy(5, 5, 0, 0, InitParamTable->sizePolicy()->hasHeightForWidth()) ); + InitParamTable->setMaximumSize( Qt::Size(32767, 32767) ); + InitParamTable->setFocusPolicy( &Qt::Table::TabFocus() ); + InitParamTable->setFrameShape( &Qt::Table::PopupPanel() ); + InitParamTable->setLineWidth( int(2) ); + InitParamTable->setMargin( int(0) ); + InitParamTable->setMidLineWidth( int(0) ); + InitParamTable->setResizePolicy( &Qt::Table::Default() ); + InitParamTable->setVScrollBarMode( &Qt::Table::Auto() ); + InitParamTable->setDragAutoScroll( 0 ); + InitParamTable->setNumRows( int(0) ); + InitParamTable->setNumCols( int(4) ); + InitParamTable->setShowGrid( 1 ); + InitParamTable->setRowMovingEnabled( 0 ); + InitParamTable->setFocusStyle( &Qt::Table::SpreadSheet() ); + musrfit_tabs->insertTab( InitializationPage, "" ); + + FittingPage = Qt::Widget(musrfit_tabs, "FittingPage"); + + textMSROutput = Qt::TextEdit(FittingPage, "textMSROutput"); + textMSROutput->setGeometry( Qt::Rect(5, 5, 545, 365) ); + textMSROutput->setOverwriteMode( 1 ); + musrfit_tabs->insertTab( FittingPage, "" ); + + TabPage = Qt::Widget(musrfit_tabs, "TabPage"); + + Minimization = Qt::ButtonGroup(TabPage, "Minimization"); + Minimization->setGeometry( Qt::Rect(6, 11, 211, 125) ); + Minimization->setExclusive( 1 ); + Minimization->setRadioButtonExclusive( 1 ); + Minimization->setProperty( "selectedId", Qt::Variant(int(0) ) ); + + MINIMIZE = Qt::RadioButton(Minimization, "MINIMIZE"); + MINIMIZE->setGeometry( Qt::Rect(16, 30, 83, 22) ); + MINIMIZE->setChecked( 1 ); + + MIGRAD = Qt::RadioButton(Minimization, "MIGRAD"); + MIGRAD->setGeometry( Qt::Rect(16, 59, 83, 22) ); + + SIMPLEX = Qt::RadioButton(Minimization, "SIMPLEX"); + SIMPLEX->setGeometry( Qt::Rect(16, 88, 83, 22) ); + + ErrorCalc = Qt::ButtonGroup(TabPage, "ErrorCalc"); + ErrorCalc->setGeometry( Qt::Rect(223, 11, 211, 125) ); + ErrorCalc->setAlignment( int(&Qt::ButtonGroup::AlignTop) ); + ErrorCalc->setExclusive( 1 ); + ErrorCalc->setRadioButtonExclusive( 1 ); + ErrorCalc->setProperty( "selectedId", Qt::Variant(int(0) ) ); + + HESSE = Qt::RadioButton(ErrorCalc, "HESSE"); + HESSE->setGeometry( Qt::Rect(19, 30, 69, 22) ); + HESSE->setChecked( 1 ); + + MINOS = Qt::RadioButton(ErrorCalc, "MINOS"); + MINOS->setGeometry( Qt::Rect(19, 59, 69, 22) ); + + go = Qt::PushButton(TabPage, "go"); + go->setGeometry( Qt::Rect(440, 15, 111, 31) ); + go->setAutoDefault( 0 ); + go->setDefault( 1 ); + + FitTextOutput = Qt::TextEdit(TabPage, "FitTextOutput"); + FitTextOutput->setGeometry( Qt::Rect(5, 140, 545, 225) ); + FitTextOutput->setOverwriteMode( 1 ); + musrfit_tabs->insertTab( TabPage, "" ); + + fileNewAction= Qt::Action(this, "fileNewAction"); + fileNewAction->setIconSet( Qt::IconSet($image1) ); + fileOpenAction= Qt::Action(this, "fileOpenAction"); + fileOpenAction->setIconSet( Qt::IconSet($image2) ); + fileSaveAction= Qt::Action(this, "fileSaveAction"); + fileSaveAction->setIconSet( Qt::IconSet($image3) ); + fileSaveAsAction= Qt::Action(this, "fileSaveAsAction"); + filePrintAction= Qt::Action(this, "filePrintAction"); + filePrintAction->setIconSet( Qt::IconSet($image4) ); + fileExitAction= Qt::Action(this, "fileExitAction"); + editUndoAction= Qt::Action(this, "editUndoAction"); + editUndoAction->setIconSet( Qt::IconSet($image5) ); + editRedoAction= Qt::Action(this, "editRedoAction"); + editRedoAction->setIconSet( Qt::IconSet($image6) ); + editCutAction= Qt::Action(this, "editCutAction"); + editCutAction->setIconSet( Qt::IconSet($image7) ); + editCopyAction= Qt::Action(this, "editCopyAction"); + editCopyAction->setIconSet( Qt::IconSet($image8) ); + editPasteAction= Qt::Action(this, "editPasteAction"); + editPasteAction->setIconSet( Qt::IconSet($image9) ); + editFindAction= Qt::Action(this, "editFindAction"); + editFindAction->setIconSet( Qt::IconSet($image10) ); + helpContentsAction= Qt::Action(this, "helpContentsAction"); + helpIndexAction= Qt::Action(this, "helpIndexAction"); + helpAboutAction= Qt::Action(this, "helpAboutAction"); + Action= Qt::Action(this, "Action"); + separatorAction= Qt::Action(this, "separatorAction"); + FileExistCheck= Qt::Action(this, "FileExistCheck"); + FileExistCheck->setToggleAction( 1 ); + FileExistCheck->setOn( 1 ); + MaualFile= Qt::Action(this, "MaualFile"); + MaualFile->setToggleAction( 1 ); + + + toolBar = Qt::ToolBar("", this, &DockTop); + + fileOpenAction->addTo(toolBar); + fileSaveAction->addTo(toolBar); + fileSaveAsAction->addTo(toolBar); + filePrintAction->addTo(toolBar); + fileExitAction->addTo(toolBar); + + + MenuBar= Qt::MenuBar( this, "MenuBar"); + + MenuBar->setGeometry( Qt::Rect(0, 0, 567, 27) ); + + fileMenu = Qt::PopupMenu( this ); + fileOpenAction->addTo( fileMenu ); + fileSaveAction->addTo( fileMenu ); + fileMenu->insertSeparator(); + filePrintAction->addTo( fileMenu ); + fileMenu->insertSeparator(); + fileExitAction->addTo( fileMenu ); + MenuBar->insertItem( "", fileMenu, 2 ); + + editMenu = Qt::PopupMenu( this ); + editUndoAction->addTo( editMenu ); + editRedoAction->addTo( editMenu ); + editMenu->insertSeparator(); + editCutAction->addTo( editMenu ); + editCopyAction->addTo( editMenu ); + editPasteAction->addTo( editMenu ); + MenuBar->insertItem( "", editMenu, 3 ); + + Options = Qt::PopupMenu( this ); + FileExistCheck->addTo( Options ); + MaualFile->addTo( Options ); + MenuBar->insertItem( "", Options, 4 ); + + helpMenu = Qt::PopupMenu( this ); + helpContentsAction->addTo( helpMenu ); + helpIndexAction->addTo( helpMenu ); + helpMenu->insertSeparator(); + helpAboutAction->addTo( helpMenu ); + MenuBar->insertItem( "", helpMenu, 5 ); + + MenuBar->insertSeparator( 6 ); + + languageChange(); + my $resize = Qt::Size(567, 490); + $resize = $resize->expandedTo(minimumSizeHint()); + resize( $resize ); + clearWState( &Qt::WState_Polished ); + + Qt::Object::connect(musrfit_tabs, SIGNAL "selected(const QString&)", this, SLOT "TabChanged()"); + Qt::Object::connect(helpAboutAction, SIGNAL "activated()", this, SLOT "helpAbout()"); + Qt::Object::connect(helpContentsAction, SIGNAL "activated()", this, SLOT "helpContents()"); + Qt::Object::connect(helpIndexAction, SIGNAL "activated()", this, SLOT "helpIndex()"); + Qt::Object::connect(editPasteAction, SIGNAL "activated()", this, SLOT "editPaste()"); + Qt::Object::connect(editCopyAction, SIGNAL "activated()", this, SLOT "editCopy()"); + Qt::Object::connect(editCutAction, SIGNAL "activated()", this, SLOT "editCut()"); + Qt::Object::connect(editRedoAction, SIGNAL "activated()", this, SLOT "editRedo()"); + Qt::Object::connect(editUndoAction, SIGNAL "activated()", this, SLOT "editUndo()"); + Qt::Object::connect(fileExitAction, SIGNAL "activated()", this, SLOT "fileExit()"); + Qt::Object::connect(filePrintAction, SIGNAL "activated()", this, SLOT "filePrint()"); + Qt::Object::connect(fileSaveAction, SIGNAL "activated()", this, SLOT "fileSave()"); + Qt::Object::connect(fileOpenAction, SIGNAL "activated()", this, SLOT "fileOpen()"); + Qt::Object::connect(fileNewAction, SIGNAL "activated()", this, SLOT "fileNew()"); + Qt::Object::connect(go, SIGNAL "clicked()", this, SLOT "GoFit()"); + Qt::Object::connect(InitParamTable, SIGNAL "valueChanged(int,int)", this, SLOT "UpdeateTable()"); + + setTabOrder(musrfit_tabs, TITLE); + setTabOrder(TITLE, FILENAME); + setTabOrder(FILENAME, RunNumbers); + setTabOrder(RunNumbers, BeamLine); + setTabOrder(BeamLine, YEAR); + setTabOrder(YEAR, FitType1); + setTabOrder(FitType1, FitType2); + setTabOrder(FitType2, FitType3); + setTabOrder(FitType3, Tis); + setTabOrder(Tis, Tfs); + setTabOrder(Tfs, BINS); + setTabOrder(BINS, FitAsyType); + setTabOrder(FitAsyType, LRBF); + setTabOrder(LRBF, ShParam_1_1); + setTabOrder(ShParam_1_1, ShParam_1_2); + setTabOrder(ShParam_1_2, ShParam_1_3); + setTabOrder(ShParam_1_3, ShParam_1_4); + setTabOrder(ShParam_1_4, ShParam_1_5); + setTabOrder(ShParam_1_5, ShParam_2_1); + setTabOrder(ShParam_2_1, ShParam_2_2); + setTabOrder(ShParam_2_2, ShParam_2_3); + setTabOrder(ShParam_2_3, ShParam_2_4); + setTabOrder(ShParam_2_4, ShParam_2_5); + setTabOrder(ShParam_2_5, ShParam_3_1); + setTabOrder(ShParam_3_1, ShParam_3_2); + setTabOrder(ShParam_3_2, ShParam_3_3); + setTabOrder(ShParam_3_3, ShParam_3_4); + setTabOrder(ShParam_3_4, ShParam_3_5); + setTabOrder(ShParam_3_5, InitParamTable); + setTabOrder(InitParamTable, textMSROutput); + + TITLELabel->setBuddy(this->TITLE); + FILENAMELabel->setBuddy(this->FILENAME); + RUNSLabel->setBuddy(this->RunNumbers); + Comp1Label->setBuddy(this->FitType1); + BINSLabel->setBuddy(this->BINS); + TfsLabel->setBuddy(this->Tfs); + TisLabel->setBuddy(this->Tis); +} + + +# Sets the strings of the subwidgets using the current +# language. + +sub languageChange +{ + setCaption(trUtf8("MuSRFit GUI") ); + setIconText(trUtf8("MuSRFitGUI") ); + TITLELabel->setText( trUtf8("Enter the label (defaul is run title from the first run)") ); + TITLE->setText( trUtf8("","Title line for MSR file (optional)") ); + Qt::ToolTip::add(TITLE, trUtf8("Title line for MSR file (optional)")); + FILENAMELabel->setText( trUtf8("Enter [name] for output [name].msr file (optional)") ); + RUNSLabel->setText( trUtf8("Input the RUN numbers separated with commas") ); + BeamLineLabel->setText( trUtf8("On beam line") ); + BeamLine->clear(); + BeamLine->insertItem( trUtf8("LEM") ); + BeamLine->insertItem( trUtf8("GPS") ); + BeamLine->insertItem( trUtf8("Dolly") ); + BeamLine->insertItem( trUtf8("LTF") ); + YEARLabel->setText( trUtf8("Year") ); + YEAR->clear(); + YEAR->insertItem( trUtf8("2009") ); + YEAR->insertItem( trUtf8("2008") ); + YEAR->insertItem( trUtf8("2007") ); + YEAR->insertItem( trUtf8("2006") ); + YEAR->insertItem( trUtf8("2005") ); + YEAR->insertItem( trUtf8("2004") ); + ComponentsLabel->setText( trUtf8("Chose type of fitting function") ); + Comp1Label->setText( trUtf8("First Component") ); + Comp3Label->setText( trUtf8("Third Component") ); + FitType2->clear(); + FitType2->insertItem( trUtf8("Exponential") ); + FitType2->insertItem( trUtf8("Gaussian") ); + FitType2->insertItem( trUtf8("Stretch Exp.") ); + FitType2->insertItem( trUtf8("Exponential Cos") ); + FitType2->insertItem( trUtf8("Gaussian Cos") ); + FitType2->insertItem( trUtf8("Stretch Cos") ); + FitType2->insertItem( trUtf8("Lorentzian Dynamic KT") ); + FitType2->insertItem( trUtf8("Gaussian Dynamic KT") ); + FitType2->insertItem( trUtf8("Background") ); + FitType2->insertItem( trUtf8("Lorentzian Kubo-Toyabe LF x Exp") ); + FitType2->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Exp") ); + FitType2->insertItem( trUtf8("Lorentzian Kubo-Toyabe LF x Str Exp") ); + FitType2->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") ); + FitType2->insertItem( trUtf8("Meissner State Model") ); + FitType2->insertItem( trUtf8("None") ); + FitType2->setCurrentItem( int(14) ); + FitType1->clear(); + FitType1->insertItem( trUtf8("Exponential") ); + FitType1->insertItem( trUtf8("Gaussian") ); + FitType1->insertItem( trUtf8("Stretch Exp.") ); + FitType1->insertItem( trUtf8("Exponential Cos") ); + FitType1->insertItem( trUtf8("Gaussian Cos") ); + FitType1->insertItem( trUtf8("Stretch Cos") ); + FitType1->insertItem( trUtf8("Lorentzian Dynamic KT") ); + FitType1->insertItem( trUtf8("Gaussian Dynamic KT") ); + FitType1->insertItem( trUtf8("Background") ); + FitType1->insertItem( trUtf8("Lorentzian Kubo-Toyabe LF x Exp") ); + FitType1->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Exp") ); + FitType1->insertItem( trUtf8("Lorentzian Kubo-Toyabe LF x Str Exp") ); + FitType1->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") ); + FitType1->insertItem( trUtf8("Meissner State Model") ); + FitType1->insertItem( trUtf8("None") ); + FitType3->clear(); + FitType3->insertItem( trUtf8("Exponential") ); + FitType3->insertItem( trUtf8("Gaussian") ); + FitType3->insertItem( trUtf8("Stretch Exp.") ); + FitType3->insertItem( trUtf8("Exponential Cos") ); + FitType3->insertItem( trUtf8("Gaussian Cos") ); + FitType3->insertItem( trUtf8("Stretch Cos") ); + FitType3->insertItem( trUtf8("Lorentzian Dynamic KT") ); + FitType3->insertItem( trUtf8("Gaussian Dynamic KT") ); + FitType3->insertItem( trUtf8("Background") ); + FitType3->insertItem( trUtf8("Lorentzian Kubo-Toyabe LF x Exp") ); + FitType3->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Exp") ); + FitType3->insertItem( trUtf8("Lorentzian Kubo-Toyabe LF x Str Exp") ); + FitType3->insertItem( trUtf8("Gaussian Kubo-Toyabe LF x Str Exp") ); + FitType3->insertItem( trUtf8("Meissner State Model") ); + FitType3->insertItem( trUtf8("None") ); + FitType3->setCurrentItem( int(14) ); + Comp2Label->setText( trUtf8("Second Component") ); + BINS->setText( trUtf8("100") ); + Tfs->setText( trUtf8("8") ); + BINSLabel->setText( trUtf8("Binning Factor") ); + Tis->setText( trUtf8("0") ); + TfsLabel->setText( trUtf8("Final Time") ); + TisLabel->setText( trUtf8("Initial Time") ); + FitAsyTypeLabel->setText( trUtf8("Fit type") ); + FitAsyType->clear(); + FitAsyType->insertItem( trUtf8("Asymmetry") ); + FitAsyType->insertItem( trUtf8("Single Histogram") ); + LRBFLabel->setText( trUtf8("Histograms list") ); + LRBF->setText( trUtf8("1,3") ); + musrfit_tabs->changeTab( RUNSPage, trUtf8("RUNS") ); + buttonGroupSharing->setTitle( trUtf8("Shared Parameters") ); + SharingComp1->setTitle( trUtf8("1st Component") ); + ShParam_1_1->setText( trUtf8("Param1") ); + ShParam_1_2->setText( trUtf8("Param2") ); + ShParam_1_3->setText( trUtf8("Param3") ); + ShParam_1_4->setText( trUtf8("Param4") ); + ShParam_1_5->setText( trUtf8("Param5") ); + Comp1ShLabel->setText( trUtf8("FitType1") ); + SharingComp2->setTitle( trUtf8("2nd Component") ); + Comp2ShLabel->setText( trUtf8("FitType2") ); + ShParam_2_1->setText( trUtf8("Param1") ); + ShParam_2_2->setText( trUtf8("Param2") ); + ShParam_2_3->setText( trUtf8("Param3") ); + ShParam_2_4->setText( trUtf8("Param4") ); + ShParam_2_5->setText( trUtf8("Param5") ); + SharingComp3->setTitle( trUtf8("3rd Component") ); + Comp3ShLabel->setText( trUtf8("FitType3") ); + ShParam_3_1->setText( trUtf8("Param1") ); + ShParam_3_2->setText( trUtf8("Param2") ); + ShParam_3_3->setText( trUtf8("Param3") ); + ShParam_3_4->setText( trUtf8("Param4") ); + ShParam_3_5->setText( trUtf8("Param5") ); + musrfit_tabs->changeTab( SharingPahe, trUtf8("Sharing") ); + InitParamTable->horizontalHeader()->setLabel( 0, trUtf8("Value") ); + InitParamTable->horizontalHeader()->setLabel( 1, trUtf8("Error") ); + InitParamTable->horizontalHeader()->setLabel( 2, trUtf8("Min") ); + InitParamTable->horizontalHeader()->setLabel( 3, trUtf8("Max") ); + musrfit_tabs->changeTab( InitializationPage, trUtf8("Initialization") ); + musrfit_tabs->changeTab( FittingPage, trUtf8("MSR File") ); + Minimization->setTitle( trUtf8("Minimization") ); + MINIMIZE->setText( trUtf8("Minimize") ); + MIGRAD->setText( trUtf8("Migrad") ); + SIMPLEX->setText( trUtf8("Simplex") ); + ErrorCalc->setTitle( trUtf8("Error Calculation") ); + HESSE->setText( trUtf8("Hesse") ); + MINOS->setText( trUtf8("Minos") ); + go->setText( trUtf8("Fit") ); + musrfit_tabs->changeTab( TabPage, trUtf8("Fitting") ); + fileNewAction->setText( trUtf8("&New") ); + fileNewAction->setMenuText( trUtf8("&New") ); + fileNewAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+N") ) ); + fileOpenAction->setText( trUtf8("&Open MSR...") ); + fileOpenAction->setMenuText( trUtf8("&Open MSR...") ); + fileOpenAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+O") ) ); + fileSaveAction->setText( trUtf8("&Save MSR") ); + fileSaveAction->setMenuText( trUtf8("&Save MSR") ); + fileSaveAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+S") ) ); + fileSaveAsAction->setText( trUtf8("Save MSR &As...") ); + fileSaveAsAction->setMenuText( trUtf8("Save MSR &As...") ); + fileSaveAsAction->setAccel( Qt::KeySequence( undef ) ); + filePrintAction->setText( trUtf8("Print") ); + filePrintAction->setMenuText( trUtf8("&Print...") ); + filePrintAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+P") ) ); + fileExitAction->setText( trUtf8("Exit") ); + fileExitAction->setMenuText( trUtf8("E&xit") ); + fileExitAction->setAccel( Qt::KeySequence( undef ) ); + editUndoAction->setText( trUtf8("Undo") ); + editUndoAction->setMenuText( trUtf8("&Undo") ); + editUndoAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+Z") ) ); + editRedoAction->setText( trUtf8("Redo") ); + editRedoAction->setMenuText( trUtf8("&Redo") ); + editRedoAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+Y") ) ); + editCutAction->setText( trUtf8("Cut") ); + editCutAction->setMenuText( trUtf8("Cu&t") ); + editCutAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+X") ) ); + editCopyAction->setText( trUtf8("Copy") ); + editCopyAction->setMenuText( trUtf8("&Copy") ); + editCopyAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+C") ) ); + editPasteAction->setText( trUtf8("Paste") ); + editPasteAction->setMenuText( trUtf8("&Paste") ); + editPasteAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+V") ) ); + editFindAction->setText( trUtf8("Find") ); + editFindAction->setMenuText( trUtf8("&Find...") ); + editFindAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+F") ) ); + helpContentsAction->setText( trUtf8("Contents") ); + helpContentsAction->setMenuText( trUtf8("&Contents...") ); + helpContentsAction->setAccel( Qt::KeySequence( undef ) ); + helpIndexAction->setText( trUtf8("Index") ); + helpIndexAction->setMenuText( trUtf8("&Index...") ); + helpIndexAction->setAccel( Qt::KeySequence( undef ) ); + helpAboutAction->setText( trUtf8("About") ); + helpAboutAction->setMenuText( trUtf8("&About") ); + helpAboutAction->setAccel( Qt::KeySequence( undef ) ); + Action->setText( trUtf8("Unnamed") ); + Action->setMenuText( trUtf8("Unnamed") ); + separatorAction->setText( undef ); + separatorAction->setMenuText( undef ); + FileExistCheck->setText( trUtf8("File exist check") ); + FileExistCheck->setMenuText( trUtf8("File exist check") ); + FileExistCheck->setWhatsThis( trUtf8("Enable/Disable checking for MSR files.") ); + MaualFile->setText( trUtf8("Maual file selection") ); + MaualFile->setMenuText( trUtf8("Maual file selection") ); + toolBar->setLabel( trUtf8("Tools") ); + MenuBar->findItem( 2 )->setText( trUtf8("&File") ); + MenuBar->findItem( 3 )->setText( trUtf8("&Edit") ); + MenuBar->findItem( 4 )->setText( trUtf8("Options") ); + MenuBar->findItem( 5 )->setText( trUtf8("&Help") ); +} + + +sub fileNew +{ + print "MuSRFitform->fileNew(): Not implemented yet.\n"; +} + +sub fileOpen +{ + + my $file=Qt::FileDialog::getOpenFileName( + ".", + "MSR Files (*.msr *.mlog)", + this, + "open file dialog", + "Choose a MSR file"); + print "Selected file: $file\n"; + + +} + +sub fileSave +{ + + my $file=Qt::FileDialog::getSaveFileName( + "", + "MSR Files (*.msr *.mlog)", + this, + "save file dialog", + "Choose a filename to save under"); + my %All=CreateAllInput(); + my $FILENAME=$All{"FILENAME"}.".msr"; + if (-e $FILENAME) { +# TODO: check if the extension is correct, or add it. + my $cmd="cp $FILENAME $file"; + my $pid=system($cmd); + } else { + if ($file ne "") { + my $Warning = "Warning: No MSR file found yet!"; + my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning); + } + } + +} + +sub filePrint +{ + print "MuSRFitform->filePrint(): Not implemented yet.\n"; +} + +sub fileExit +{ + + Qt::Application::exit( 0 ); + +} + +sub editUndo +{ + print "MuSRFitform->editUndo(): Not implemented yet.\n"; +} + +sub editRedo +{ + print "MuSRFitform->editRedo(): Not implemented yet.\n"; +} + +sub editCut +{ + print "MuSRFitform->editCut(): Not implemented yet.\n"; +} + +sub editCopy +{ + print "MuSRFitform->editCopy(): Not implemented yet.\n"; +} + +sub editPaste +{ + print "MuSRFitform->editPaste(): Not implemented yet.\n"; +} + +sub helpIndex +{ + print "MuSRFitform->helpIndex(): Not implemented yet.\n"; +} + +sub helpContents +{ + print "MuSRFitform->helpContents(): Not implemented yet.\n"; +} + +sub helpAbout +{ + + my $AboutText=" +This is a GUI that uses the musrfit binary, developed by Andreas Suter, +to fit muSR spectra. + +MuSRFitGUI is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +MuSRFitGUI is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with MuSRFitGUI. If not, see . + +Copyright 2009 by Zaher Salman and the LEM Group. + +"; + my $AboutWindow = Qt::MessageBox::information( this, "About MuSRFit GUI",$AboutText); + +} + +sub CreateAllInput +{ + +# TODO: Need to deliver shared parameters also + my %All=(); + $All{"TITLE"}= TITLE->text; + $All{"FILENAME"}= FILENAME->text; + $All{"RunNumbers"} = RunNumbers->text; + $All{"BeamLine"} = BeamLine->currentText; + $All{"YEAR"} =YEAR->currentText; + $All{"Tis"} = Tis->text; + $All{"Tfs"} = Tfs->text; + $All{"BINS"} = BINS->text; + $All{"FitAsyType"} = FitAsyType->currentText; + $All{"LRBF"} = LRBF->text; + $All{"RunNumbers"} =~ s/[\ \.\~\/\&\*\[\;\>\<\^\$\(\)\`\|\]\'\@]/,/g; + my @RUNS = split( /,/, $All{"RunNumbers"} ); + +# Construct fittypes that can be understood by MSR.pm + my %FTs=(0,"Exponential", + 1,"Gaussian", + 2,"Stretch", + 3,"ExponentialCos", + 4,"GaussianCos", + 5,"StretchCos", + 6,"LDKTLF", + 7,"GDKTLF", + 8,"Background", + 9,"LLFExp", + 10,"GLFExp", + 11,"LLFSExp", + 12,"GLFSExp", + 13,"Meissner", + 14,"None" + ); + + my $FT1=FitType1->currentItem; + my $FT2=FitType2->currentItem; + my $FT3=FitType3->currentItem; + $All{"FitType1"} = $FTs{$FT1}; + $All{"FitType2"} = $FTs{$FT2}; + $All{"FitType3"} = $FTs{$FT3}; + my @FitTypes =(); + my $FitType=""; + foreach $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) { + if ( $FitType ne "None" ) { + push( @FitTypes, $FitType ); + } + } + +# Also theory block and paramets list + my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes); + $All{"Full_T_Block"}=$Full_T_Block; + $All{"Paramcomp_ref"}=$Paramcomp_ref; + my @Paramcomp = @$Paramcomp_ref; + +# TODO: Read initial values of paramets from tabel + my $erradd = "d"; + my $minadd = "_min"; + my $maxadd = "_max"; + my $NRows = InitParamTable->numRows(); + my $Header=InitParamTable->verticalHeader(); + if ($NRows > 0) { + for (my $i=0;$i<$NRows;$i++) { +# Take label of row, i.e. name of parameter + my $Param=$Header->label($i); +# Then take the value, error, max and min (as numbers) + $All{"$Param"}=1.0*InitParamTable->text($i,0); + $All{"$erradd$Param"}=1.0*InitParamTable->text($i,1); + $All{"$Param$minadd"}=1.0*InitParamTable->text($i,2); + $All{"$Param$maxadd"}=1.0*InitParamTable->text($i,3); + } + } + + +# Shared settings are detected here + my $Shared = 0; + my $PCount =0; + my $Component=1; + foreach $FitType (@FitTypes) { + my $Parameters=$Paramcomp[$Component-1]; + my @Params = split( /\s+/, $Parameters ); + + if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) { + unshift( @Params, "Alpha" ); + } + elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) { + unshift( @Params, ( "N0", "NBg" ) ); + } + +# This is the counter for parameters of this component + my $NP=1; + $Shared = 0; +# Change state/label of parameters + foreach my $Param (@Params) { + my $Param_ORG = $Param; + if ( $#FitTypes != 0 && ( $Param ne "Alpha" && $Param ne "N0" && $Param ne "NBg" ) ){ + $Param = join( "", $Param, "_", $Component); + } + +# Is there any point of sharing, multiple runs? + if ( $#RUNS == 0 ) { + $Shared = 1; + } else { +# Check if shared or not, construct name of checkbox, find its handle and then +# check if it is checked + my $ChkName="ShParam_".$Component."_".$NP; + my $ChkBx = child($ChkName); + $Shared = $ChkBx->isChecked(); + } + $All{"Sh_$Param"}=$Shared; + $NP++; + }#Loop on parameters + $Component++; + }# Loop on components +# Done with shared parameters detecting + +# Construct a default filename if empty + if ( $All{"FILENAME"} eq "") { + $All{"FILENAME"}=$RUNS[0]."_".$All{"BeamLine"}."_".$All{"YEAR"}; + } + + if ( $All{"go"} eq "" ) { + $All{"go"}="PLOT"; + } + +# Get minimization process + my $Min = Minimization->selectedId(); + if ($Min==0) { + $All{"Minimization"}= "MINIMIZE"; + $All{"go"}="MIGRAD"; + } + elsif ($Min==1) { + $All{"Minimization"}= "MIGRAD"; + $All{"go"}="MIGRAD"; + } + elsif ($Min==2) { + $All{"Minimization"}= "SIMPLEX"; + $All{"go"}="SIMPLAEX"; + } + +# Get Error calculation process + my $Err = ErrorCalc->selectedId(); + if ($Err==0) { + $All{"ErrorCalc"}= "HESSE"; +# $All{"go"}="MIGRAD"; + } + elsif ($Err==1) { + $All{"ErrorCalc"}= "MINOS"; + $All{"go"}="MINOS"; + } + +# Return Hash with all important values + return %All; + +} + +sub CallMSRCreate +{ + + use MSR; + my %All=CreateAllInput(); + if ($All{"RunNumbers"} ne "") { + my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All); + UpdateMSRFileInitTable(); + } + +} + +sub UpdateMSRFileInitTable +{ + + my %All=CreateAllInput(); + my $FILENAME=$All{"FILENAME"}; + open (MSRF,q{<},"$FILENAME.msr" ); + my @lines = ; + close(IFILE); + textMSROutput->setText(""); + foreach my $line (@lines) { + textMSROutput->append("$line"); + } + + my $FPBlock_ref=MSR::ExtractParamBlk(@lines); + my @FPBloc = @$FPBlock_ref; + + my $PCount=0; + foreach my $line (@FPBloc) { + $PCount++; +# print "line $PCount: $line \n"; + my @Param=split(/\s+/,$line); +# print "$Param[2]=$Param[3]+-$Param[4] from $Param[5] to $Param[6]\n"; + InitParamTable->setText($PCount-1,0,1.0*$Param[3]); + InitParamTable->setText($PCount-1,1,1.0*$Param[4]); + InitParamTable->setText($PCount-1,2,1.0*$Param[5]); + InitParamTable->setText($PCount-1,3,1.0*$Param[6]); + } + return; + +} + +sub ActivateShComp +{ + + my %All=CreateAllInput(); + my @RUNS = split( /,/, $All{"RunNumbers"} ); + + # Hide all sharing components + SharingComp1->setHidden(1); + SharingComp2->setHidden(1); + SharingComp3->setHidden(1); + SharingComp1->setEnabled(0); + SharingComp2->setEnabled(0); + SharingComp3->setEnabled(0); + + my @FitTypes =(); + foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) { + if ( $FitType ne "None" ) { + push( @FitTypes, $FitType ); + } + } + +# Get number of parameters to determine the size of the table + my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes); +# For now the line below does not work. Why? +# my $Paramcomp_ref=$All{"Paramcomp_ref"}; + my @Paramcomp = @$Paramcomp_ref; + my $Full_T_Block= $All{"Full_T_Block"}; + + my $Component=1; + foreach my $FitType (@FitTypes) { + my $Parameters=$Paramcomp[$Component-1]; + my @Params = split( /\s+/, $Parameters ); + + if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) { + unshift( @Params, "Alpha" ); + } + elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) { + unshift( @Params, ( "N0", "NBg" ) ); + } + + +# Make the component appear first (only if we have multiple runs) + my $ShCompG="SharingComp".$Component; + my $ShCG = child($ShCompG); + if ($#RUNS>0) { + $ShCG->setHidden(0); + $ShCG->setEnabled(1); + } + my $CompShLabel = "Comp".$Component."ShLabel"; + my $CompShL = child($CompShLabel); + $CompShL->setText($All{"FitType$Component"}); + +# Change state/label of parameters + for (my $i=1; $i<=5;$i++) { + my $ParamChkBx="ShParam_".$Component."_".$i; + my $ChkBx = child($ParamChkBx); + if ($Params[$i-1] ne "") { + $ChkBx->setHidden(0); + $ChkBx->setEnabled(1); + $ChkBx ->setText($Params[$i-1]); + } else { + $ChkBx->setHidden(1); + } + } + $Component++; + } + +} + +sub InitializeTab +{ + +# "Smart" default value of the fit parameters. + my %Defaults = ( + "Asy", "0.15", "dAsy", "0.01", + "Asy_min", "0", "Asy_max", "0", + "Alpha", "1.0", "dAlpha", "0.01", + "Alpha_min", "0", "Alpha_max", "0", + "N0", "300.0", "dN0", "0.01", + "N0_min", "0", "N0_max", "0", + "NBg", "30.0", "dNBg", "0.01", + "NBg_min", "0", "NBg_max", "0", + "Lam", "1.0", "dLam", "0.01", + "Lam_min", "0", "Lam_max", "0", + "Gam", "1.0", "dGam", "0.01", + "Gam_min", "0", "Gam_max", "0", + "Bet", "0.5", "dBet", "0.01", + "Bet_min", "0", "Bet_max", "0", + "Two", "2.0", "dTwo", "0.0", + "Two_min", "0", "Two_max", "0", + "Del", "0.1", "dDel", "0.01", + "Del_min", "0", "Del_max", "0", + "Sgm", "0.1", "dSgm", "0.01", + "Sgm_min", "0", "Sgm_max", "0", + "Aa", "0.1", "dAa", "0.01", + "Aa_min", "0", "Aa_max", "0", + "q", "0.1", "dq", "0.01", + "q_min", "0", "q_max", "0", + "Bg", "0.036", "dBg", "0.01", + "Bg_min", "0", "Bg_max", "0", + "bgrlx", "0.", "dbgrlx", "0.0", + "bgrlx_min", "0", "bgrlx_max", "0", + "Frq", "1.0", "dFrq", "1.", + "Frq_min", "0", "Frq_max", "0", + "Field", "100.0", "dField", "1.", + "Field_min", "0", "Field_max", "0", + "Energy", "14.1", "dEnergy", "0.", + "Energy_min", "0", "Energy_max", "0", + "DeadLayer", "10.", "dDeadLayer", "0.1", + "DeadLayer_min", "0", "DeadLayer_max", "0", + "Lambda", "128.1", "dLambda", "0.1", + "Lambda_min", "0", "Lambda_max", "0", + "Phi", "1.", "dPhi", "0.01", + "Phi_min", "0", "Phi_max", "0" + ); + + my $erradd = "d"; + my $minadd = "_min"; + my $maxadd = "_max"; + +# First assume nothing is shared + my $Shared = 0; + + my %All=CreateAllInput(); + my @RUNS = split( /,/, $All{"RunNumbers"} ); + + my @FitTypes =(); + foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) { + if ( $FitType ne "None" ) { push( @FitTypes, $FitType ); } + } + + InitParamTable->setLeftMargin(100); + +# Get theory block to determine the size of the table + my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes); +# For now the line below does not work. Why? +# my $Paramcomp_ref=$All{"Paramcomp_ref"}; + my @Paramcomp = @$Paramcomp_ref; + my $Full_T_Block= $All{"Full_T_Block"}; + + my $NRows = InitParamTable->numRows(); + +# Remove any rows in table + if ($NRows > 0) { + for (my $i=0;$i<$NRows;$i++) { +# TODO: Better remove the row rather than hide it. + InitParamTable->hideRow($i); + } + } + + my $PCount =0; + my $iRun =0; + my $value =0; + my $error = 0; + my $minvalue = 0; + my $maxvalue = 0; + + foreach my $RUN (@RUNS) { + $iRun++; + my $Component=1; + foreach my $FitType (@FitTypes) { + my $Parameters=$Paramcomp[$Component-1]; + my @Params = split( /\s+/, $Parameters ); + + if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) { + unshift( @Params, "Alpha" ); + } + elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) { + unshift( @Params, ( "N0", "NBg" ) ); + } + + +# This is the counter for parameters of this component + my $NP=1; + $Shared = 0; +# Change state/label of parameters + foreach my $Param (@Params) { + my $Param_ORG = $Param; + if ( $#FitTypes != 0 && ( $Param ne "Alpha" && $Param ne "N0" && $Param ne "NBg" ) ){ + $Param = join( "", $Param, "_", "$Component" ); + } + + $Shared = $All{"Sh_$Param"}; +# It there are multiple runs index the parameters accordingly + $Param=$Param."_".$iRun; +# Check if this parameter has been initialized befor. If not take from defaults +# print "$Param=".$All{"$Param"}."\n"; + $value = $All{"$Param"}; + if ( $value ne "" ) { + $error = $All{"$erradd$Param"}; + $minvalue = $All{"$Param$minadd"}; + $maxvalue = $All{"$Param$maxadd"}; + } else { +# I need this although it is already in the MSR.pm module, just for this table +# We can remove it from the MSR module later... + $value = $Defaults{$Param_ORG}; + $error = $Defaults{ join( "", $erradd, $Param_ORG ) }; + $minvalue = $Defaults{ join("", $Param_ORG, $minadd ) }; + $maxvalue = $Defaults{ join("", $Param_ORG, $maxadd ) }; + } + + if ( $Shared!=1 || $iRun == 1 ) { + $PCount++; + +# Add row in table, set its label and fill the values of parametr + if ($PCount>$NRows) { + InitParamTable->setNumRows($PCount); + } + InitParamTable->verticalHeader()->setLabel( $PCount-1,$Param); + InitParamTable->showRow($PCount-1); + InitParamTable->setText($PCount-1,0,$value); + InitParamTable->setText($PCount-1,1,$error); + InitParamTable->setText($PCount-1,2,$minvalue); + InitParamTable->setText($PCount-1,3,$maxvalue); + } + $NP++; + }#Loop on parameters + $Component++; + }# Loop on components + }# Loop on runs + +} + +sub TabChanged +{ + +# TODO: First check if there are some runs given, otherwise disbale +# TODO: Check if the MSR file exists and decide whether to use it or not + my %All=CreateAllInput(); + + my $SlectedTab = musrfit_tabs->currentPageIndex; +# Check if the option for checking for existing files is selected + my $FileExistCheck= FileExistCheck->isOn(); + my $FILENAME=$All{"FILENAME"}.".msr"; + if ($All{"RunNumbers"} ne "" && $SlectedTab==4 && $FileExistCheck==1) { + if (-e $FILENAME) { +# Warning: MSR file exists + my $Warning = "Warning: MSR file $FILENAME Already exists!\nChange name or backup file if you do not want to loose it."; + my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning); + } + } + +# First make sure we have sharing initialized + ActivateShComp(); + InitializeTab(); + UpdateMSRFileInitTable(); + +} + +sub GoFit +{ + + my %All=CreateAllInput(); + CallMSRCreate(); + my $FILENAME=$All{"FILENAME"}.".msr"; + if (-e $FILENAME) { + my $cmd="musrfit -t $FILENAME"; + my $pid = open(FTO,"$cmd 2>&1 |"); + while () { + FitTextOutput->append("$_"); +# print "line= ".$_; + } + close(FTO); + $cmd="musrview $FILENAME &"; + $pid = system($cmd); + } else { + FitTextOutput->append("Cannot find MSR file!"); + } + FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------"); +# update MSR File tab and initialization table + UpdateMSRFileInitTable(); + return; + +} + +sub UpdeateTable +{ + print "MuSRFitform->UpdeateTable(): Not implemented yet.\n"; +} + +1; + + +package main; + +use Qt; +use MuSRFitform; + +my $a = Qt::Application(\@ARGV); +my $w = MuSRFitform; +$a->setMainWidget($w); +$w->show; +exit $a->exec; diff --git a/src/external/MuSRFitGUI/MuSRFit.ui b/src/external/MuSRFitGUI/MuSRFit.ui new file mode 100755 index 00000000..d2cd1537 --- /dev/null +++ b/src/external/MuSRFitGUI/MuSRFit.ui @@ -0,0 +1,1996 @@ + +MuSRFitform + + + MuSRFitform + + + + 0 + 0 + 567 + 490 + + + + + 7 + 7 + 1 + 1 + + + + + 21 + 227 + + + + MuSRFit GUI + + + image0 + + + MuSRFitGUI + + + + musrfit_tabs + + + true + + + + 5 + 0 + 560 + 400 + + + + + 7 + 7 + 1 + 1 + + + + + 560 + 400 + + + + + 32767 + 32767 + + + + + RUNSPage + + + RUNS + + + + layout24 + + + + 5 + 1 + 545 + 360 + + + + + unnamed + + + + TITLELabel + + + + 5 + 5 + 0 + 0 + + + + Enter the label (defaul is run title from the first run) + + + TITLE + + + + + TITLE + + + + 5 + 0 + 1 + 1 + + + + + Title line for MSR file (optional) + + + Title line for MSR file (optional) + + + + + layout17 + + + + unnamed + + + + FILENAMELabel + + + Enter [name] for output [name].msr file (optional) + + + FILENAME + + + + + FILENAME + + + + 5 + 0 + 0 + 0 + + + + + + + + layout16 + + + + unnamed + + + + RUNSLabel + + + Input the RUN numbers separated with commas + + + RunNumbers + + + + + RunNumbers + + + + 5 + 0 + 0 + 0 + + + + + + + + layout18 + + + + unnamed + + + + BeamLineLabel + + + On beam line + + + + + + LEM + + + + + GPS + + + + + Dolly + + + + + LTF + + + + BeamLine + + + + + YEARLabel + + + Year + + + + + + 2009 + + + + + 2008 + + + + + 2007 + + + + + 2006 + + + + + 2005 + + + + + 2004 + + + + YEAR + + + + + + + ComponentsLabel + + + Chose type of fitting function + + + + + layout19 + + + + unnamed + + + + Comp1Label + + + First Component + + + FitType1 + + + + + Comp3Label + + + Third Component + + + FitType1_2_2 + + + + + + Exponential + + + + + Gaussian + + + + + Stretch Exp. + + + + + Exponential Cos + + + + + Gaussian Cos + + + + + Stretch Cos + + + + + Lorentzian Dynamic KT + + + + + Gaussian Dynamic KT + + + + + Background + + + + + Lorentzian Kubo-Toyabe LF x Exp + + + + + Gaussian Kubo-Toyabe LF x Exp + + + + + Lorentzian Kubo-Toyabe LF x Str Exp + + + + + Gaussian Kubo-Toyabe LF x Str Exp + + + + + Meissner State Model + + + + + None + + + + FitType2 + + + + 5 + 0 + 0 + 0 + + + + 14 + + + + + + Exponential + + + + + Gaussian + + + + + Stretch Exp. + + + + + Exponential Cos + + + + + Gaussian Cos + + + + + Stretch Cos + + + + + Lorentzian Dynamic KT + + + + + Gaussian Dynamic KT + + + + + Background + + + + + Lorentzian Kubo-Toyabe LF x Exp + + + + + Gaussian Kubo-Toyabe LF x Exp + + + + + Lorentzian Kubo-Toyabe LF x Str Exp + + + + + Gaussian Kubo-Toyabe LF x Str Exp + + + + + Meissner State Model + + + + + None + + + + FitType1 + + + + 5 + 0 + 0 + 0 + + + + 20 + + + false + + + false + + + + + + Exponential + + + + + Gaussian + + + + + Stretch Exp. + + + + + Exponential Cos + + + + + Gaussian Cos + + + + + Stretch Cos + + + + + Lorentzian Dynamic KT + + + + + Gaussian Dynamic KT + + + + + Background + + + + + Lorentzian Kubo-Toyabe LF x Exp + + + + + Gaussian Kubo-Toyabe LF x Exp + + + + + Lorentzian Kubo-Toyabe LF x Str Exp + + + + + Gaussian Kubo-Toyabe LF x Str Exp + + + + + Meissner State Model + + + + + None + + + + FitType3 + + + + 5 + 0 + 0 + 0 + + + + 14 + + + + + Comp2Label + + + Second Component + + + FitType1_2 + + + + + + + layout20 + + + + unnamed + + + + BINS + + + + 5 + 0 + 0 + 0 + + + + 100 + + + + + Tfs + + + + 5 + 0 + 0 + 0 + + + + 8 + + + + + BINSLabel + + + Binning Factor + + + BINS + + + + + Tis + + + + 5 + 0 + 0 + 0 + + + + 0 + + + + + TfsLabel + + + Final Time + + + Tfs + + + + + TisLabel + + + Initial Time + + + Tis + + + + + + + layout23 + + + + unnamed + + + + FitAsyTypeLabel + + + Fit type + + + + + + Asymmetry + + + + + Single Histogram + + + + FitAsyType + + + + + LRBFLabel + + + Histograms list + + + + + LRBF + + + + 5 + 0 + 0 + 0 + + + + 1,3 + + + + + + + + + + SharingPahe + + + Sharing + + + + buttonGroupSharing + + + + 0 + 0 + 550 + 400 + + + + + 7 + 7 + 0 + 0 + + + + Shared Parameters + + + AlignLeft + + + false + + + + layoutShComp + + + + 30 + 50 + 500 + 311 + + + + + unnamed + + + + SharingComp1 + + + false + + + + 5 + 3 + 0 + 0 + + + + 1st Component + + + AlignLeft + + + + layoutComp1 + + + + 30 + 70 + 81 + 190 + + + + + unnamed + + + + ShParam_1_1 + + + Param1 + + + + + ShParam_1_2 + + + Param2 + + + + + ShParam_1_3 + + + Param3 + + + + + ShParam_1_4 + + + Param4 + + + + + ShParam_1_5 + + + false + + + + 234 + 233 + 232 + + + + Param5 + + + false + + + + + + + Comp1ShLabel + + + + 2 + 30 + 185 + 20 + + + + + 255 + 255 + 127 + + + + FitType1 + + + + + + SharingComp2 + + + false + + + + 5 + 3 + 0 + 0 + + + + 2nd Component + + + + Comp2ShLabel + + + + 2 + 30 + 185 + 20 + + + + + 255 + 255 + 127 + + + + FitType2 + + + + + layoutComp2 + + + + 20 + 70 + 81 + 190 + + + + + unnamed + + + + ShParam_2_1 + + + Param1 + + + + + ShParam_2_2 + + + Param2 + + + + + ShParam_2_3 + + + Param3 + + + + + ShParam_2_4 + + + Param4 + + + + + ShParam_2_5 + + + Param5 + + + + + + + + SharingComp3 + + + false + + + + 5 + 3 + 0 + 0 + + + + 3rd Component + + + AlignJustify|AlignVCenter + + + + Comp3ShLabel + + + + 2 + 30 + 185 + 20 + + + + + 255 + 255 + 127 + + + + FitType3 + + + + + layoutComp3 + + + + 30 + 70 + 81 + 190 + + + + + unnamed + + + + ShParam_3_1 + + + Param1 + + + + + ShParam_3_2 + + + Param2 + + + + + ShParam_3_3 + + + Param3 + + + + + ShParam_3_4 + + + Param4 + + + + + ShParam_3_5 + + + Param5 + + + + + + + + + + + + InitializationPage + + + Initialization + + + + + Value + + + + + Error + + + + + Min + + + + + Max + + + + InitParamTable + + + + 5 + 0 + 545 + 560 + + + + + 5 + 5 + 0 + 0 + + + + + 32767 + 32767 + + + + TabFocus + + + PopupPanel + + + 2 + + + 0 + + + 0 + + + Default + + + Auto + + + false + + + 0 + + + 4 + + + true + + + false + + + SpreadSheet + + + + + + FittingPage + + + MSR File + + + + textMSROutput + + + + 5 + 5 + 545 + 365 + + + + true + + + + + + TabPage + + + Fitting + + + + Minimization + + + + 6 + 11 + 211 + 125 + + + + Minimization + + + true + + + true + + + 0 + + + + MINIMIZE + + + + 16 + 30 + 83 + 22 + + + + Minimize + + + true + + + + + MIGRAD + + + + 16 + 59 + 83 + 22 + + + + Migrad + + + + + SIMPLEX + + + + 16 + 88 + 83 + 22 + + + + Simplex + + + + + + ErrorCalc + + + + 223 + 11 + 211 + 125 + + + + Error Calculation + + + AlignTop + + + true + + + true + + + 0 + + + + HESSE + + + + 19 + 30 + 69 + 22 + + + + Hesse + + + true + + + + + MINOS + + + + 19 + 59 + 69 + 22 + + + + Minos + + + + + + go + + + + 440 + 15 + 111 + 31 + + + + Fit + + + false + + + true + + + + + FitTextOutput + + + + 5 + 140 + 545 + 225 + + + + true + + + + + + + + MenuBar + + + + 0 + 0 + 567 + 27 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + toolBar + + + Tools + + + + + + + + + + + + fileNewAction + + + image1 + + + &New + + + &New + + + Ctrl+N + + + + + fileOpenAction + + + image2 + + + &Open MSR... + + + &Open MSR... + + + Ctrl+O + + + + + fileSaveAction + + + image3 + + + &Save MSR + + + &Save MSR + + + Ctrl+S + + + + + fileSaveAsAction + + + Save MSR &As... + + + Save MSR &As... + + + + + + + + filePrintAction + + + image4 + + + Print + + + &Print... + + + Ctrl+P + + + + + fileExitAction + + + Exit + + + E&xit + + + + + + + + editUndoAction + + + image5 + + + Undo + + + &Undo + + + Ctrl+Z + + + + + editRedoAction + + + image6 + + + Redo + + + &Redo + + + Ctrl+Y + + + + + editCutAction + + + image7 + + + Cut + + + Cu&t + + + Ctrl+X + + + + + editCopyAction + + + image8 + + + Copy + + + &Copy + + + Ctrl+C + + + + + editPasteAction + + + image9 + + + Paste + + + &Paste + + + Ctrl+V + + + + + editFindAction + + + image10 + + + Find + + + &Find... + + + Ctrl+F + + + + + helpContentsAction + + + Contents + + + &Contents... + + + + + + + + helpIndexAction + + + Index + + + &Index... + + + + + + + + helpAboutAction + + + About + + + &About + + + + + + + + Action + + + Unnamed + + + Unnamed + + + + + separatorAction + + + + + + + + + + + FileExistCheck + + + true + + + true + + + File exist check + + + File exist check + + + Enable/Disable checking for MSR files. + + + + + MaualFile + + + true + + + Maual file selection + + + Maual file selection + + + + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000d349444154388db594510e84200c44a7864bd9fb673c16fe50b7a95501dd97104983435b06842422ab6ab5f946ca6941074b0ca813cd36eaa5f89f050049811352d53aac8a96b165640256fe468ac546b33eb5c298ededa3f05b1655adbef4b8c062a3e92fbc117d83643ebe6275d53dd1dd637345af3b3e3bbcb8e19470763b23ddc2de3924c58b676d2a67897b717f4b25dcd848f5a3b9e4f8c651dd200992c86205680f4f82c555b51e6b92fe5a2502c0cc3bd40a13b98a133faf17cb286639833fc4db56bce17fafdb9762deeb438fd0083bbf3298df1bba5b870000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000007f49444154388ded95510a0021084475d9db041ec0e8fa5ecbfdda852d4b11fa6b2028a3570c53a188c00edd7d819935b2504470357f5945559d36000022720f60823d11910b1fac88a894f2f599592d5b52e05aeb6f6cc153e0d6da50ebe12930e2321039f09b0c6fb3542a223ae0033ee085cc2b1d790b3ce1ae3f6f9b150f6d5433af47a4f4c20000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000ae49444154388db594510ec3200c436db45371b6691fd3cee66bb18f5135a219235af04f442b5e2c03a124ec50d942dd09be4537d45a9b5d4be2f85f1243e06393d748126d53661d9e854a624ac6633c40cff8576e51280010406b0d00dab104b9c69d19e887774201f64ebc7c8f342fc678b0ce553cc76b752e37e368d69edc8c2df4f58c01ef8f4f7533fe176a1e482ef4e2380b6ac0b9d0d36a57161430833e130aacdef62f9acd8ab4793cea0d051970cdbc4f01b20000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000ad49444154388dd595310e842010453f8686c482f3d0ccc58c85f16234731e0b922d770b3386150d62d084d7100cbe7cc6411433e309340038e7be35a5ccacb44ce6691d8711f0de178988687b878800005da590093abfe418132c3efdb2cd25a9904d6c82850936791e4b81b59452ce4be2bb644bb14f7695c712b7274e6a3c4f69ebe488bbe1547cb6b09477db6d18cb45fb5dde3ed2f18feae89bb4d76eed8995dc79b5ae2766567fe2dafc0045362bc8717a5b490000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000028c49444154388d8d95af7bdb301086dfec0938319bc530b061350c2cf458cb5a18b83f6181a363a3851debd8020b1dd6b01a0adacc62772c03b21de7d7b38a28962eef7dbaef2c4fcab2e4d268db762f22a4697ab46e6600a82a0021049224c1393719c74d2f52011121cff30174ba371280f7fe2ce62a18a0aaaa33d8692255c539f779f02580999d25e8e753f8972bdcbd990dc1ce399c7347f5eeeb2f2267f5bdaa5855499284b66d1191c1a8f1b874fccf28c6ccce3a620ced935d32f7aae25ecd25a5e375553dea90ff82ebba663e9f9365d955786fe476bb2584b01749c8b274a8f5115855f7de7baa5d851482880c80d3b957dad62d6559d284869b9b9b7d5114a4693a99f46f9eaaeeabca13ea063580cb4a019ca408020e7ced797fdfd13435aac6623167b55a45c5bdd2e2ee0e97a6a81a9872668b1920946c79e32f4b5bb2fcc8a9aa1da8e1808ff70f7ee933d3086d78f8fa40324baeaaec4745c54f7ee0f1ecd8f1222f14fe9e97f699ba0e1846e33dd3d0049e9eeeafba7b3a5252ee5852221414dcdede9248466b35cf2fbf092190ce52a606785fc77e340311628e9848041c2e56dc14c4f1cdbe738f27b38c1d1598916659dcefdc99b6758d1789f53463f0cd4174b13b89335001e29a00de1a8c7887f8aa1a3c7174edd62f580fc486a650a229b19d87c8a173a4f7743414658a80b5a33f6827761c688028d8e98ec3aca53b677f36f27cc9176ca47210abf1d1baf908eafab00eda01bb72ce663356aba7a8d87bdf5b0562100408d139b388915e951d601c6a8e1922b05eafc9b26c329dcfe7bc6ddef8b3d9a06ac4fb47386a3e193dcb01399cb3eba6f57a4d9ee71380e195aeeb7afffabaa1e9be5f8a76a61c9c397c3540b58dbf83912f731e1f1f592c16c325f40f010f7cb0f1b5c3040000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000009b49444154388ded943b0e80200c865be3a91889c7320e8463998ebd164e68417949184cfcc7b67c6de803991946681a42fdc152734bb052e49eecd600e845a3b4a19f0aa5c83187ce1230967c1f541cc363602931ede47ce5b73ff64112caac31059509d7edb23d362f86a6803965a7e22db408ae6d5a33b8075eb52025b8f75b73d9b0e7bad14e4e4e82ec49d74aa7a0009d15e7f4bdebf6834f1d172546d17f21be920000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000009349444154388ded943d0e80200c46a9f1548cc4631907c2b148c75e0b27b0226083b2f12d24d03efa0740446a849621d409e65af30df418f6a36c4c64400a063e155a639038d52ed01a433c4b11a3bfa02d47be72bb3ca854e3987e2b5d2203255829d3aee6b522fd04cee1bf82df1add05964c4f023b2b73928e64758e9d55ca6cf20791eb560ade90daeb930ae67f3cc10f9d5ba746085c06e1e50000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000009d49444154388dcdd4410e80200c04c0d6f8aa9e7936e7fd169e9a20222ca0d15e4c340eeda64101c81bb5b53e9a591a794fc32bf51f988981826b10005d8219600af6f2aed918444494d9e31c64a7f8762bbccb91ccc98c63ca9f8fc08e79b76631310774ee8a9880701a1f080a04ede1b7700d2d0f68e155b88732f80566d15e0ded3193ed145c566bba7df4e7bceb5664d5bb221f77366fea129aa903bb2561adb1d6f6e70000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000d349444154388db595b10e83300c44cf88af8a18d9f91936d485aa7fd5d99fd5eb5099461093109493bc70c9f3c94984a82a5aa86b4205200078b64055a51a4ca6d922520deff7109335230911e155f806f652d7c2b751a412ffbeada700d531d9ac60c62bc887e33f5d78f75f24878a1bee3dd3302c08e17d48b681491e2a96e74d531aeede0a8379be79f3dc01f8005810c28b3696a25b71e6db9c4d21bca93acaadc4a943b546b7137baa4e9c6bde2c716769bc8a13e72a569f7bff763fab679c53f58caf6c2a511178ff088af6b4fa997e01dfa4987b8b9435470000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000ec49444154388db5954d0e83201085df989e6a1237bd96c44583d7eaa6c95c6bba402dc850d0d29798093ff3cd13044944f00fddbe0d32b31efb44845ac0b439b62000a0512f159056b1a1156ab53759f9044001c03f3c0007c0c3cd6e07c52ee3b6353f764e00f438495ef50de59133780c1e420883219e51396ffd2a7c3289476e04a77906f83318bfdeb9986ab02b5f89a9d6cd2bc3dd9c27d94a37cf5ce3a313d5a988235aa03a6587275be3129c68c9a071c1005f54e44ecd8e6bae2d7837c7477817c756d19f1d5b058996be6bdccdb1a5ddc07ad16bf9f17a568057aafdf3989f85ebfdbbaae0ab7a030d36e3e74e2086d10000000049454e44ae426082 + + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000025949444154388db59521931b3910469fb7027a98c42c2838cb6cb686031d689685f95d86816b66c385033dcc0305354c62dd6c021c576d2e97f3a672fb21a94bf5f449ad6e2dfabee723f4f02154e0d3db4929654e299173a69a01e04488311263a4699ac51f8373ce737f3ee36360bdfb0c4eaef194185ecfa494d86c36b3f7fe5df045dff7e49ce7979717369f3b365f760098196a8a6154abf4df8e4836b6dbedbb9c3fa8eadc9f7bbaafcfb4db0e33c392a0690963a0f642c98576db41f00cc3f0aeab784829e16364d37500485e525266b2814946c43cd247ac56e2a6654c8952ca7c1f3c4db49b35866105d298487e4443219330293408960d4490e0c839df776caa38ef2856c8cd44594f8813ac188e0878521d51a76020ae619aa6bbe04f00550d11401503304372a4b1404e3dda26c063a50202d755ffed180cccae49b3db181a13f278a6b4198280292660b52022f7c1c107524a985e81560dc3c896b05031c0ca35a65529a51263bc0f8e3192fb0b5a15b37a051443cc43126aadfc3808354f0404e7dc3b1c87b008de33bcbea2802a80923853dc8813a1944a29151b126ddbe28327e73cabea6f9fdd03c06ab5c215a8c7338d298d35f8658344871804035e2f3c3d3df1f8f8b84863e2743ab1dfefc939ff2b7c716b9baa3a0fc3c09812e2049a6b82ac54c4a0eb3a4208b7529e8fc72387c301e71cbbdd8ed56af553a92ffed98f4b2973ce995a2b2282f7fe96ac5ffa434a69fee19aaeeb7edafc17f09f4a55e7d3e9c4e17060b95cf2fcfccc7abd5efc35f8a6cbe532eff77ba66962bbddfebde3b72aa5cc87c30155fd7fc16ff5617fde773b427a020f23b15a0000000049454e44ae426082 + + + + + musrfit_tabs + selected(const QString&) + MuSRFitform + TabChanged() + + + helpAboutAction + activated() + MuSRFitform + helpAbout() + + + helpContentsAction + activated() + MuSRFitform + helpContents() + + + helpIndexAction + activated() + MuSRFitform + helpIndex() + + + editPasteAction + activated() + MuSRFitform + editPaste() + + + editCopyAction + activated() + MuSRFitform + editCopy() + + + editCutAction + activated() + MuSRFitform + editCut() + + + editRedoAction + activated() + MuSRFitform + editRedo() + + + editUndoAction + activated() + MuSRFitform + editUndo() + + + fileExitAction + activated() + MuSRFitform + fileExit() + + + filePrintAction + activated() + MuSRFitform + filePrint() + + + fileSaveAction + activated() + MuSRFitform + fileSave() + + + fileOpenAction + activated() + MuSRFitform + fileOpen() + + + fileNewAction + activated() + MuSRFitform + fileNew() + + + go + clicked() + MuSRFitform + GoFit() + + + InitParamTable + valueChanged(int,int) + MuSRFitform + UpdeateTable() + + + + musrfit_tabs + TITLE + FILENAME + RunNumbers + BeamLine + YEAR + FitType1 + FitType2 + FitType3 + Tis + Tfs + BINS + FitAsyType + LRBF + ShParam_1_1 + ShParam_1_2 + ShParam_1_3 + ShParam_1_4 + ShParam_1_5 + ShParam_2_1 + ShParam_2_2 + ShParam_2_3 + ShParam_2_4 + ShParam_2_5 + ShParam_3_1 + ShParam_3_2 + ShParam_3_3 + ShParam_3_4 + ShParam_3_5 + InitParamTable + textMSROutput + + + MuSRFit.ui.h + + + fileNew() + fileOpen() + fileSave() + filePrint() + fileExit() + editUndo() + editRedo() + editCut() + editCopy() + editPaste() + helpIndex() + helpContents() + helpAbout() + CreateAllInput() + CallMSRCreate() + UpdateMSRFileInitTable() + ActivateShComp() + InitializeTab() + TabChanged() + GoFit() + UpdeateTable() + + + diff --git a/src/external/MuSRFitGUI/MuSRFit.ui.h b/src/external/MuSRFitGUI/MuSRFit.ui.h new file mode 100755 index 00000000..06f041b9 --- /dev/null +++ b/src/external/MuSRFitGUI/MuSRFit.ui.h @@ -0,0 +1,616 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you want to add, delete, or rename functions or slots, use +** Qt Designer to update this file, preserving your code. +** +** You should not define a constructor or destructor in this file. +** Instead, write your code in functions called init() and destroy(). +** These will automatically be called by the form's constructor and +** destructor. +*****************************************************************************/ + +# This file is part of MuSRFitGUI. +# +# MuSRFitGUI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# MuSRFitGUI is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with MuSRFitGUI. If not, see . +# +# Copyright 2009 by Zaher Salman and the LEM Group. +# + +void Form1::fileNew() +{ +} + +void Form1::fileOpen() +{ + my $file=Qt::FileDialog::getOpenFileName( + ".", + "MSR Files (*.msr *.mlog)", + this, + "open file dialog", + "Choose a MSR file"); + print "Selected file: $file\n"; + +} + + +void Form1::fileSave() +{ + my $file=Qt::FileDialog::getSaveFileName( + "", + "MSR Files (*.msr *.mlog)", + this, + "save file dialog", + "Choose a filename to save under"); + my %All=CreateAllInput(); + my $FILENAME=$All{"FILENAME"}.".msr"; + if (-e $FILENAME) { +# TODO: check if the extension is correct, or add it. + my $cmd="cp $FILENAME $file"; + my $pid=system($cmd); + } else { + if ($file ne "") { + my $Warning = "Warning: No MSR file found yet!"; + my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning); + } + } +} + +void Form1::filePrint() +{ + +} + + +void Form1::fileExit() +{ + Qt::Application::exit( 0 ); +} + + +void Form1::editUndo() +{ + +} + + +void Form1::editRedo() +{ + +} + + +void Form1::editCut() +{ + +} + + +void Form1::editCopy() +{ + +} + + +void Form1::editPaste() +{ + +} + + +void Form1::helpIndex() +{ + +} + + +void Form1::helpContents() +{ + +} + + +void Form1::helpAbout() +{ + my $AboutText=" +This is a GUI that uses the musrfit binary, developed by Andreas Suter, +to fit muSR spectra. + +MuSRFitGUI is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +MuSRFitGUI is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with MuSRFitGUI. If not, see . + +Copyright 2009 by Zaher Salman and the LEM Group. + +"; + my $AboutWindow = Qt::MessageBox::information( this, "About MuSRFit GUI",$AboutText); +} + +void MuSRFitform::CreateAllInput() +{ +# TODO: Need to deliver shared parameters also + my %All=(); + $All{"TITLE"}= TITLE->text; + $All{"FILENAME"}= FILENAME->text; + $All{"RunNumbers"} = RunNumbers->text; + $All{"BeamLine"} = BeamLine->currentText; + $All{"YEAR"} =YEAR->currentText; + $All{"Tis"} = Tis->text; + $All{"Tfs"} = Tfs->text; + $All{"BINS"} = BINS->text; + $All{"FitAsyType"} = FitAsyType->currentText; + $All{"LRBF"} = LRBF->text; + $All{"RunNumbers"} =~ s/[\ \.\~\/\&\*\[\;\>\<\^\$\(\)\`\|\]\'\@]/,/g; + my @RUNS = split( /,/, $All{"RunNumbers"} ); + +# Construct fittypes that can be understood by MSR.pm + my %FTs=(0,"Exponential", + 1,"Gaussian", + 2,"Stretch", + 3,"ExponentialCos", + 4,"GaussianCos", + 5,"StretchCos", + 6,"LDKTLF", + 7,"GDKTLF", + 8,"Background", + 9,"LLFExp", + 10,"GLFExp", + 11,"LLFSExp", + 12,"GLFSExp", + 13,"Meissner", + 14,"None" + ); + + my $FT1=FitType1->currentItem; + my $FT2=FitType2->currentItem; + my $FT3=FitType3->currentItem; + $All{"FitType1"} = $FTs{$FT1}; + $All{"FitType2"} = $FTs{$FT2}; + $All{"FitType3"} = $FTs{$FT3}; + my @FitTypes =(); + my $FitType=""; + foreach $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) { + if ( $FitType ne "None" ) { + push( @FitTypes, $FitType ); + } + } + +# Also theory block and paramets list + my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes); + $All{"Full_T_Block"}=$Full_T_Block; + $All{"Paramcomp_ref"}=$Paramcomp_ref; + my @Paramcomp = @$Paramcomp_ref; + +# TODO: Read initial values of paramets from tabel + my $erradd = "d"; + my $minadd = "_min"; + my $maxadd = "_max"; + my $NRows = InitParamTable->numRows(); + my $Header=InitParamTable->verticalHeader(); + if ($NRows > 0) { + for (my $i=0;$i<$NRows;$i++) { +# Take label of row, i.e. name of parameter + my $Param=$Header->label($i); +# Then take the value, error, max and min (as numbers) + $All{"$Param"}=1.0*InitParamTable->text($i,0); + $All{"$erradd$Param"}=1.0*InitParamTable->text($i,1); + $All{"$Param$minadd"}=1.0*InitParamTable->text($i,2); + $All{"$Param$maxadd"}=1.0*InitParamTable->text($i,3); + } + } + + +# Shared settings are detected here + my $Shared = 0; + my $PCount =0; + my $Component=1; + foreach $FitType (@FitTypes) { + my $Parameters=$Paramcomp[$Component-1]; + my @Params = split( /\s+/, $Parameters ); + + if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) { + unshift( @Params, "Alpha" ); + } + elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) { + unshift( @Params, ( "N0", "NBg" ) ); + } + +# This is the counter for parameters of this component + my $NP=1; + $Shared = 0; +# Change state/label of parameters + foreach my $Param (@Params) { + my $Param_ORG = $Param; + if ( $#FitTypes != 0 && ( $Param ne "Alpha" && $Param ne "N0" && $Param ne "NBg" ) ){ + $Param = join( "", $Param, "_", $Component); + } + +# Is there any point of sharing, multiple runs? + if ( $#RUNS == 0 ) { + $Shared = 1; + } else { +# Check if shared or not, construct name of checkbox, find its handle and then +# check if it is checked + my $ChkName="ShParam_".$Component."_".$NP; + my $ChkBx = child($ChkName); + $Shared = $ChkBx->isChecked(); + } + $All{"Sh_$Param"}=$Shared; + $NP++; + }#Loop on parameters + $Component++; + }# Loop on components +# Done with shared parameters detecting + +# Construct a default filename if empty + if ( $All{"FILENAME"} eq "") { + $All{"FILENAME"}=$RUNS[0]."_".$All{"BeamLine"}."_".$All{"YEAR"}; + } + + if ( $All{"go"} eq "" ) { + $All{"go"}="PLOT"; + } + +# Get minimization process + my $Min = Minimization->selectedId(); + if ($Min==0) { + $All{"Minimization"}= "MINIMIZE"; + $All{"go"}="MIGRAD"; + } + elsif ($Min==1) { + $All{"Minimization"}= "MIGRAD"; + $All{"go"}="MIGRAD"; + } + elsif ($Min==2) { + $All{"Minimization"}= "SIMPLEX"; + $All{"go"}="SIMPLAEX"; + } + +# Get Error calculation process + my $Err = ErrorCalc->selectedId(); + if ($Err==0) { + $All{"ErrorCalc"}= "HESSE"; +# $All{"go"}="MIGRAD"; + } + elsif ($Err==1) { + $All{"ErrorCalc"}= "MINOS"; + $All{"go"}="MINOS"; + } + +# Return Hash with all important values + return %All; +} + +void MuSRFitform::CallMSRCreate() +{ + use MSR; + my %All=CreateAllInput(); + if ($All{"RunNumbers"} ne "") { + my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All); + UpdateMSRFileInitTable(); + } +} + +void MuSRFitform::UpdateMSRFileInitTable() +{ + my %All=CreateAllInput(); + my $FILENAME=$All{"FILENAME"}; + open (MSRF,q{<},"$FILENAME.msr" ); + my @lines = ; + close(IFILE); + textMSROutput->setText(""); + foreach my $line (@lines) { + textMSROutput->append("$line"); + } + + my $FPBlock_ref=MSR::ExtractParamBlk(@lines); + my @FPBloc = @$FPBlock_ref; + + my $PCount=0; + foreach my $line (@FPBloc) { + $PCount++; +# print "line $PCount: $line \n"; + my @Param=split(/\s+/,$line); +# print "$Param[2]=$Param[3]+-$Param[4] from $Param[5] to $Param[6]\n"; + InitParamTable->setText($PCount-1,0,1.0*$Param[3]); + InitParamTable->setText($PCount-1,1,1.0*$Param[4]); + InitParamTable->setText($PCount-1,2,1.0*$Param[5]); + InitParamTable->setText($PCount-1,3,1.0*$Param[6]); + } + return; +} + +void MuSRFitform::ActivateShComp() +{ + my %All=CreateAllInput(); + my @RUNS = split( /,/, $All{"RunNumbers"} ); + + # Hide all sharing components + SharingComp1->setHidden(1); + SharingComp2->setHidden(1); + SharingComp3->setHidden(1); + SharingComp1->setEnabled(0); + SharingComp2->setEnabled(0); + SharingComp3->setEnabled(0); + + my @FitTypes =(); + foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) { + if ( $FitType ne "None" ) { + push( @FitTypes, $FitType ); + } + } + +# Get number of parameters to determine the size of the table + my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes); +# For now the line below does not work. Why? +# my $Paramcomp_ref=$All{"Paramcomp_ref"}; + my @Paramcomp = @$Paramcomp_ref; + my $Full_T_Block= $All{"Full_T_Block"}; + + my $Component=1; + foreach my $FitType (@FitTypes) { + my $Parameters=$Paramcomp[$Component-1]; + my @Params = split( /\s+/, $Parameters ); + + if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) { + unshift( @Params, "Alpha" ); + } + elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) { + unshift( @Params, ( "N0", "NBg" ) ); + } + + +# Make the component appear first (only if we have multiple runs) + my $ShCompG="SharingComp".$Component; + my $ShCG = child($ShCompG); + if ($#RUNS>0) { + $ShCG->setHidden(0); + $ShCG->setEnabled(1); + } + my $CompShLabel = "Comp".$Component."ShLabel"; + my $CompShL = child($CompShLabel); + $CompShL->setText($All{"FitType$Component"}); + +# Change state/label of parameters + for (my $i=1; $i<=5;$i++) { + my $ParamChkBx="ShParam_".$Component."_".$i; + my $ChkBx = child($ParamChkBx); + if ($Params[$i-1] ne "") { + $ChkBx->setHidden(0); + $ChkBx->setEnabled(1); + $ChkBx ->setText($Params[$i-1]); + } else { + $ChkBx->setHidden(1); + } + } + $Component++; + } +} + +void MuSRFitform::InitializeTab() +{ +# "Smart" default value of the fit parameters. + my %Defaults = ( + "Asy", "0.15", "dAsy", "0.01", + "Asy_min", "0", "Asy_max", "0", + "Alpha", "1.0", "dAlpha", "0.01", + "Alpha_min", "0", "Alpha_max", "0", + "N0", "300.0", "dN0", "0.01", + "N0_min", "0", "N0_max", "0", + "NBg", "30.0", "dNBg", "0.01", + "NBg_min", "0", "NBg_max", "0", + "Lam", "1.0", "dLam", "0.01", + "Lam_min", "0", "Lam_max", "0", + "Gam", "1.0", "dGam", "0.01", + "Gam_min", "0", "Gam_max", "0", + "Bet", "0.5", "dBet", "0.01", + "Bet_min", "0", "Bet_max", "0", + "Two", "2.0", "dTwo", "0.0", + "Two_min", "0", "Two_max", "0", + "Del", "0.1", "dDel", "0.01", + "Del_min", "0", "Del_max", "0", + "Sgm", "0.1", "dSgm", "0.01", + "Sgm_min", "0", "Sgm_max", "0", + "Aa", "0.1", "dAa", "0.01", + "Aa_min", "0", "Aa_max", "0", + "q", "0.1", "dq", "0.01", + "q_min", "0", "q_max", "0", + "Bg", "0.036", "dBg", "0.01", + "Bg_min", "0", "Bg_max", "0", + "bgrlx", "0.", "dbgrlx", "0.0", + "bgrlx_min", "0", "bgrlx_max", "0", + "Frq", "1.0", "dFrq", "1.", + "Frq_min", "0", "Frq_max", "0", + "Field", "100.0", "dField", "1.", + "Field_min", "0", "Field_max", "0", + "Energy", "14.1", "dEnergy", "0.", + "Energy_min", "0", "Energy_max", "0", + "DeadLayer", "10.", "dDeadLayer", "0.1", + "DeadLayer_min", "0", "DeadLayer_max", "0", + "Lambda", "128.1", "dLambda", "0.1", + "Lambda_min", "0", "Lambda_max", "0", + "Phi", "1.", "dPhi", "0.01", + "Phi_min", "0", "Phi_max", "0" + ); + + my $erradd = "d"; + my $minadd = "_min"; + my $maxadd = "_max"; + +# First assume nothing is shared + my $Shared = 0; + + my %All=CreateAllInput(); + my @RUNS = split( /,/, $All{"RunNumbers"} ); + + my @FitTypes =(); + foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) { + if ( $FitType ne "None" ) { push( @FitTypes, $FitType ); } + } + + InitParamTable->setLeftMargin(100); + +# Get theory block to determine the size of the table + my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes); +# For now the line below does not work. Why? +# my $Paramcomp_ref=$All{"Paramcomp_ref"}; + my @Paramcomp = @$Paramcomp_ref; + my $Full_T_Block= $All{"Full_T_Block"}; + + my $NRows = InitParamTable->numRows(); + +# Remove any rows in table + if ($NRows > 0) { + for (my $i=0;$i<$NRows;$i++) { +# TODO: Better remove the row rather than hide it. + InitParamTable->hideRow($i); + } + } + + my $PCount =0; + my $iRun =0; + my $value =0; + my $error = 0; + my $minvalue = 0; + my $maxvalue = 0; + + foreach my $RUN (@RUNS) { + $iRun++; + my $Component=1; + foreach my $FitType (@FitTypes) { + my $Parameters=$Paramcomp[$Component-1]; + my @Params = split( /\s+/, $Parameters ); + + if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) { + unshift( @Params, "Alpha" ); + } + elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) { + unshift( @Params, ( "N0", "NBg" ) ); + } + + +# This is the counter for parameters of this component + my $NP=1; + $Shared = 0; +# Change state/label of parameters + foreach my $Param (@Params) { + my $Param_ORG = $Param; + if ( $#FitTypes != 0 && ( $Param ne "Alpha" && $Param ne "N0" && $Param ne "NBg" ) ){ + $Param = join( "", $Param, "_", "$Component" ); + } + + $Shared = $All{"Sh_$Param"}; +# It there are multiple runs index the parameters accordingly + $Param=$Param."_".$iRun; +# Check if this parameter has been initialized befor. If not take from defaults +# print "$Param=".$All{"$Param"}."\n"; + $value = $All{"$Param"}; + if ( $value ne "" ) { + $error = $All{"$erradd$Param"}; + $minvalue = $All{"$Param$minadd"}; + $maxvalue = $All{"$Param$maxadd"}; + } else { +# I need this although it is already in the MSR.pm module, just for this table +# We can remove it from the MSR module later... + $value = $Defaults{$Param_ORG}; + $error = $Defaults{ join( "", $erradd, $Param_ORG ) }; + $minvalue = $Defaults{ join("", $Param_ORG, $minadd ) }; + $maxvalue = $Defaults{ join("", $Param_ORG, $maxadd ) }; + } + + if ( $Shared!=1 || $iRun == 1 ) { + $PCount++; + +# Add row in table, set its label and fill the values of parametr + if ($PCount>$NRows) { + InitParamTable->setNumRows($PCount); + } + InitParamTable->verticalHeader()->setLabel( $PCount-1,$Param); + InitParamTable->showRow($PCount-1); + InitParamTable->setText($PCount-1,0,$value); + InitParamTable->setText($PCount-1,1,$error); + InitParamTable->setText($PCount-1,2,$minvalue); + InitParamTable->setText($PCount-1,3,$maxvalue); + } + $NP++; + }#Loop on parameters + $Component++; + }# Loop on components + }# Loop on runs +} + +void MuSRFitform::TabChanged() +{ +# TODO: First check if there are some runs given, otherwise disbale +# TODO: Check if the MSR file exists and decide whether to use it or not + my %All=CreateAllInput(); + + my $SlectedTab = musrfit_tabs->currentPageIndex; +# Check if the option for checking for existing files is selected + my $FileExistCheck= FileExistCheck->isOn(); + my $FILENAME=$All{"FILENAME"}.".msr"; + if ($All{"RunNumbers"} ne "" && $SlectedTab==4 && $FileExistCheck==1) { + if (-e $FILENAME) { +# Warning: MSR file exists + my $Warning = "Warning: MSR file $FILENAME Already exists!\nChange name or backup file if you do not want to loose it."; + my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning); + } + } + +# First make sure we have sharing initialized + ActivateShComp(); + InitializeTab(); + UpdateMSRFileInitTable(); +} + + +void MuSRFitform::GoFit() +{ + my %All=CreateAllInput(); + CallMSRCreate(); + my $FILENAME=$All{"FILENAME"}.".msr"; + if (-e $FILENAME) { + my $cmd="musrfit -t $FILENAME"; + my $pid = open(FTO,"$cmd 2>&1 |"); + while () { + FitTextOutput->append("$_"); +# print "line= ".$_; + } + close(FTO); + $cmd="musrview $FILENAME &"; + $pid = system($cmd); + } else { + FitTextOutput->append("Cannot find MSR file!"); + } + FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------"); +# update MSR File tab and initialization table + UpdateMSRFileInitTable(); + return; +} + + + +void MuSRFitform::UpdeateTable() +{ + +}