Skip to content
Permalink
Browse files

model 'by plugins' -> 'cylindrical objects' -> LongCylShell is in

principle obsolete as the more general model is available under
'by plugins' -> 'thin obj.' -> 'local cylindrical obj.' -> Rod+SD+EllCylSh
Nevertheless LongCylShell returns now a non-zero result.

further test of non-parametric determination of size distributions
  • Loading branch information...
Kohlbrecher committed May 16, 2019
1 parent 4f82fc5 commit ad65218b07adc3718f1c0aa594a0a98419c03678
@@ -566,8 +566,9 @@ set sasfit(filelabel) {}
set sasfit(scale_types_x) {"x" "pow(x,2)" "pow(x,3)" "pow(x,4)" "log10(x)" "log(x)" \
"sqrt(x)" "1/x" "1/sqrt(x)" "arcsinh(x)" }
set sasfit(scale_types_y) {"y" "pow(y,2)" "pow(y,3)" "pow(y,4)" "y*x" "y*pow(x,2)" \
"y*pow(x,3)" "y*pow(x,4)" "y*pow(x,6)" "log10(y)" "log(abs(y))" \
"log(abs(y*x))" "log(abs(y*pow(x,2)))" "log(abs(y*pow(x,4)))"
"y*pow(x,3)" "y*pow(x,4)" "y*pow(x,6)" "y*pow(x,-2)" \
"y*pow(x,-3)" "y*pow(x,-4)" "y*pow(x,-6)" "log10(y)" "log(abs(y))" \
"log(abs(y*x))" "log(abs(y*pow(x,2)))" "log(abs(y*pow(x,4)))" \
"sqrt(abs(y))" "1/y" "1/sqrt(abs(y))" "arcsinh(y)" }

proc clear_sasfit_config {sasfit_arr prefix suffixlist
@@ -3078,6 +3079,7 @@ proc SaveCmd {} {
puts_arr $fid ::ozyrGraph
puts_arr $fid ::ozfrGraph
puts_arr $fid ::Detector2DIQGraph
puts_arr $fid ::EMOptions
close $fid
}
set ::sasfit(lastProjectFile) $filename
@@ -275,30 +275,57 @@ radiobutton $w.guinierrange.lowQ.radio.zimm -text "Zimm" \
RefreshStructParFit
} \
-highlightthickness 0
button $w.guinierrange.lowQ.pr -text "calculate p(r)" \
button $w.guinierrange.lowQ.nrmuch -text "calculate N(R) using MuCh" \
-command {
global StructParData
global StructParData IQGraph SDGraph
RefreshStructParFit
sasfit_timer_start "\nStart apply"
set DRMuCh [sasfit_DR_MuCh StructParData [list $sasfit(Q) $sasfit(I) $sasfit(DI)]]
sasfit_timer_stop "Apply" "finished" ""

clearGraph_el SDGraph
Put_Graph_el SDGraph [lindex $DRMuCh 0] [lindex $DRMuCh 1]

set SDGraph(e,symbol) [lreplace $SDGraph(e,symbol) 0 0 none]
set SDGraph(e,linehide) [lreplace $SDGraph(e,linehide) 0 0 1]
RefreshGraph SDGraph

clearGraph_el IQGraph
set indx1 -1
Put_Graph_el IQGraph [lindex $DRMuCh 2] [lindex $DRMuCh 3]


incr indx1
set IQGraph(e,symbol) [lreplace $IQGraph(e,symbol) $indx1 $indx1 none]
set IQGraph(e,linehide) [lreplace $IQGraph(e,linehide) $indx1 $indx1 1]
set IQGraph(e,dashcolor) [lreplace $IQGraph(e,dashcolor) $indx1 $indx1 red]
set IQGraph(l,legendtext) [lreplace $IQGraph(l,legendtext) \
$indx1 $indx1 Fit]

# draw the data (for fit mode)
Put_Graph_el IQGraph $sasfit(Q) $sasfit(I) $sasfit(DI) $sasfit(res)
incr indx1
RefreshGraph IQGraph
} \
-highlightthickness 0
button $w.guinierrange.lowQ.nr -text "calculate N(R)" \
button $w.guinierrange.lowQ.nrem -text "calculate N(R) using EM" \
-command {
global StructParData IQGraph SDGraph
RefreshStructParFit
sasfit_timer_start "\nStart apply"
set prEM [sasfit_prEM StructParData [list $sasfit(Q) $sasfit(I) $sasfit(DI)]]
set DREM [sasfit_DR_EM StructParData [list $sasfit(Q) $sasfit(I) $sasfit(DI)]]
sasfit_timer_stop "Apply" "finished" ""

clearGraph_el SDGraph
Put_Graph_el SDGraph [lindex $prEM 0] [lindex $prEM 1]
Put_Graph_el SDGraph [lindex $DREM 0] [lindex $DREM 1]

set SDGraph(e,symbol) [lreplace $SDGraph(e,symbol) 0 0 none]
set SDGraph(e,linehide) [lreplace $SDGraph(e,linehide) 0 0 1]
RefreshGraph SDGraph

clearGraph_el IQGraph
set indx1 -1
Put_Graph_el IQGraph [lindex $prEM 2] [lindex $prEM 3]
Put_Graph_el IQGraph [lindex $DREM 2] [lindex $DREM 3]


incr indx1
@@ -314,8 +341,45 @@ button $w.guinierrange.lowQ.nr -text "calculate N(R)" \
RefreshGraph IQGraph
} \
-highlightthickness 0

button $w.guinierrange.lowQ.nrsdm -text "calculate N(R) using SDM" \
-command {
global StructParData IQGraph SDGraph
RefreshStructParFit
sasfit_timer_start "\nStart apply"
set DRSDM [sasfit_DR_SDM StructParData [list $sasfit(Q) $sasfit(I) $sasfit(DI)]]
sasfit_timer_stop "Apply" "finished" ""

clearGraph_el SDGraph
Put_Graph_el SDGraph [lindex $DRSDM 0] [lindex $DRSDM 1]

set SDGraph(e,symbol) [lreplace $SDGraph(e,symbol) 0 0 none]
set SDGraph(e,linehide) [lreplace $SDGraph(e,linehide) 0 0 1]
RefreshGraph SDGraph

clearGraph_el IQGraph
set indx1 -1
Put_Graph_el IQGraph [lindex $DRSDM 2] [lindex $DRSDM 3]


incr indx1
set IQGraph(e,symbol) [lreplace $IQGraph(e,symbol) $indx1 $indx1 none]
set IQGraph(e,linehide) [lreplace $IQGraph(e,linehide) $indx1 $indx1 1]
set IQGraph(e,dashcolor) [lreplace $IQGraph(e,dashcolor) $indx1 $indx1 red]
set IQGraph(l,legendtext) [lreplace $IQGraph(l,legendtext) \
$indx1 $indx1 Fit]

# draw the data (for fit mode)
Put_Graph_el IQGraph $sasfit(Q) $sasfit(I) $sasfit(DI) $sasfit(res)
incr indx1
RefreshGraph IQGraph
} \
-highlightthickness 0

pack $w.guinierrange.lowQ.radio.guinier \
$w.guinierrange.lowQ.radio.zimm $w.guinierrange.lowQ.pr $w.guinierrange.lowQ.nr\
$w.guinierrange.lowQ.radio.zimm \
$w.guinierrange.lowQ.nrmuch $w.guinierrange.lowQ.nrem\
$w.guinierrange.lowQ.nrsdm \
-padx 2m -pady 1m \
-fill both -expand yes -side left -anchor w
#pack $w.guinierrange.lowQ.radio2.debye \
@@ -24,6 +24,16 @@

SASFIT_PLUGIN_INFO_DECL;

// use lookup table for ff_pcs_ellcylsh(q, param)
#define sasfit_ff_pcs_ellcylsh(q,p) imp_ptr->functions[0].func((q),(p))
#define sasfit_ff_pcs_ellcylsh_f(q,p) imp_ptr->functions[0].func_f((q),(p))
#define sasfit_ff_pcs_ellcylsh_v(q,p,d) imp_ptr->functions[0].func_v((q),(p),(d))

// use lookup table for sasfit_sq_p__q___rod(q, param)
#define sasfit_sq_p__q___rod(q,p) imp_ptr->functions[1].func((q),(p))
#define sasfit_sq_p__q___rod_f(q,p) imp_ptr->functions[1].func_f((q),(p))
#define sasfit_sq_p__q___rod_v(q,p,d) imp_ptr->functions[1].func_v((q),(p),(d))

#else


@@ -25,7 +25,10 @@ SASFIT_PLUGIN_EXP_ADD( ff_torus )
SASFIT_PLUGIN_EXP_END

// import functions from other plugins
SASFIT_PLUGIN_IMP_NONE
SASFIT_PLUGIN_IMP_BEGIN( 2 )
SASFIT_PLUGIN_IMP_ADD( ff_pcs_ellcylsh )
SASFIT_PLUGIN_IMP_ADD( sq_p__q___rod )
SASFIT_PLUGIN_IMP_END

SASFIT_PLUGIN_INTERFACE

@@ -16,6 +16,9 @@

scalar sasfit_ff_longcylshell(scalar q, sasfit_param * param)
{
scalar Pcs,Pprime;
sasfit_param subParam;

SASFIT_ASSERT_PTR(param); // assert pointer param is valid

SASFIT_CHECK_COND1((q < 0.0), param, "q(%lg) < 0",q);
@@ -24,7 +27,26 @@ scalar sasfit_ff_longcylshell(scalar q, sasfit_param * param)
SASFIT_CHECK_COND1((L < 0.0), param, "L(%lg) < 0",L); // modify condition to your needs

// insert your code here
return 0.0;

sasfit_init_param( &subParam );
subParam.p[0] = R;
subParam.p[1] = 0; //SIGMA_R0;
subParam.p[2] = 1.0; // EPSILON;
subParam.p[3] = T;
subParam.p[4] = 0; //SIGMA_T0;

subParam.p[7] = ETA_CORE;
subParam.p[8] = ETA_SHELL;
subParam.p[9] = ETA_SOLV;

Pcs=sasfit_ff_pcs_ellcylsh(q,&subParam);

subParam.p[0] = L;
subParam.p[1] = 0.0;
subParam.p[2] = 0; //SIGMA_L;
Pprime = sasfit_sq_p__q___rod(q,&subParam);

return Pcs*Pprime;
}

scalar sasfit_ff_longcylshell_f(scalar q, sasfit_param * param)
@@ -112,21 +112,26 @@ struct extrapolPar {
typedef struct
{
scalar Rmax;
scalar Dmax;
int Nshannon;
scalar Delta_r;
scalar smooth;
scalar eps;
scalar chi2;
int maxit;
char spacing[132];
char iteration_scheme[132];
char smooth_type[132];
bool smooth_bool;
char seed[132];
scalar dim;
int nh, nR;
scalar C4, C0;
double *in, *out, *xwork, **A, **S;
double *in, *out, *xwork, **A, **S, **T3, *Ih4mC4;
double *h, *Ih, *Iexp, *DIh, *Ith, *r, *dr, *dh;
gsl_vector *DR;
sasfit_oz_root_algorithms root_algorithm;
sasfit_oz_root_algorithms root_algorithm;

// char ct[STRLEN];
} EM_param_t;

@@ -82,7 +82,11 @@ int Sasfit_OrnsteinZernickeFitCmd _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, char **argv));
int Sasfit_FredholmIntegrals_RegularizationCmd _ANSI_ARGS_((struct sasfit_CData *SASFIT_CData,
Tcl_Interp *interp, int argc, char **argv));
int Sasfit_prEM_Cmd _ANSI_ARGS_((ClientData clientData,
int Sasfit_DR_EM_Cmd _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, char **argv));
int Sasfit_DR_MuCh_Cmd _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, char **argv));
int Sasfit_DR_SDM_Cmd _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int argc, char **argv));

#endif
@@ -2996,7 +2996,9 @@ SASFIT_LIB_EXPORT int Sasfit_Init(Tcl_Interp *interp)
Tcl_CreateCommand(interp, "sasfit_DebyeFit", (Tcl_CmdProc*) Sasfit_DebyeFitCmd, NULL, NULL);
Tcl_CreateCommand(interp, "sasfit_OrnsteinZernickeFit", (Tcl_CmdProc*) Sasfit_OrnsteinZernickeFitCmd, NULL, NULL);

Tcl_CreateCommand(interp, "sasfit_prEM", (Tcl_CmdProc*) Sasfit_prEM_Cmd, NULL, NULL);
Tcl_CreateCommand(interp, "sasfit_DR_EM", (Tcl_CmdProc*) Sasfit_DR_EM_Cmd, NULL, NULL);
Tcl_CreateCommand(interp, "sasfit_DR_MuCh", (Tcl_CmdProc*) Sasfit_DR_MuCh_Cmd, NULL, NULL);
Tcl_CreateCommand(interp, "sasfit_DR_SDM", (Tcl_CmdProc*) Sasfit_DR_SDM_Cmd, NULL, NULL);
Tcl_CreateCommand(interp, "sasfit_FredholmIntegrals_Regularization", (Tcl_CmdProc*) Sasfit_FredholmIntegrals_RegularizationCmd, (void *)SASFIT_CData, NULL);


0 comments on commit ad65218

Please sign in to comment.
You can’t perform that action at this time.