proc getSeed {field} {
set MAXINT [expr {pow(2, 31) - 1}]
expr srand([clock clicks])
set val [expr {int(rand() * $MAXINT)}]
if {[expr {$val % 2}] == 0} {
incr val -1
}
$field setCurrentValue $val
}
GuidoApp appHandle "BM GSLIB NSCORE"
$appHandle setParam license "test"
set appStatus [$appHandle invoke]
$appHandle destroy
if {$appStatus == "-10311"} {
return
}
if [catch {
set nuqs_rows [GuidoGetParamBufferValue [GuidoExecServer GetLastValues {function_name = "BM GSLIB NSCORE" form_name = "NSCOREParameters." table = "nuqs" table_row = 0 field_name = "__num_instances"}] constant]
} result] {
set nuqs_rows 1
}
GuidoForm NSCOREParameters {
-help_id 1589
-default_buttons
-label "FRM_NSCORE_1"
-tip GSLIB_NSCORE_FORM_TIP
-defaults_management true
-layout BoxLayout Y_AXIS
GuidoTabbedPane tabPane {
GuidoPanel anonymous {
-layout CentreLineLayout
-label GUI_FILES
GuidoFileBrowserField string_file_location {
-display_length 26
-file_mask *.str
-link string_file_id
-format none
-input true
-label "Input location"
-max_length 252
-null false
-tip GSLIB_IK3D_STRING_FILE_TIP
}
GuidoField string_file_id {
-display_length 10
-format none
-input true
-label "ID number"
-max_length 16
-null false
-tip GSLIB_IK3D_STRING_FILE_TIP
}
GuidoField range {
-default 1
-display_length 10
-format range
-label "String range"
-max_length 26
-null false
-tip GSLIB_IK3D_STRING_FILE_TIP
-translate none
}
GuidoComboBox field {
-display_length 3
-exclusive true
-label "D-field"
-max_length 4
-default D1
-null false
-tip GSLIB_IK3D_STRING_FILE_TIP
-value_in D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19 D20 D21 D22 D23 D24 D25 D26 D27 D28 D29 D30 D31 D32 D33 D34 D35 D36 D37 D38 D39 D40 D41 D42 D43 D44 D45 D46 D47 D48 D49 D50 D51 D52 D53 D54 D55 D56 D57 D58 D59 D60 D61 D62 D63 D64 D65 D66 D67 D68 D69 D70 D71 D72 D73 D74 D75 D76 D77 D78 D79 D80 D81 D82 D83 D84 D85 D86 D87 D88 D89 D90 D91 D92 D93 D94 D95 D96 D97 D98 D99 D100
}
GuidoComboBox weight_field {
-display_length 3
-exclusive true
-label "Weight"
-max_length 4
-null true
-tip GSLIB_SGSIM_WEIGHT_DFIELD_TIP
-value_in D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19 D20 D21 D22 D23 D24 D25 D26 D27 D28 D29 D30 D31 D32 D33 D34 D35 D36 D37 D38 D39 D40 D41 D42 D43 D44 D45 D46 D47 D48 D49 D50 D51 D52 D53 D54 D55 D56 D57 D58 D59 D60 D61 D62 D63 D64 D65 D66 D67 D68 D69 D70 D71 D72 D73 D74 D75 D76 D77 D78 D79 D80 D81 D82 D83 D84 D85 D86 D87 D88 D89 D90 D91 D92 D93 D94 D95 D96 D97 D98 D99 D100
}
GuidoField tmin {
-display_length 10
-label "Minimum"
-default -1E+21
-null false
-tip GSLIB_IK3D_TMIN_TIP
-format double
}
GuidoField tmax {
-display_length 10
-label "Maximum"
-default 1E+21
-null false
-tip GSLIB_IK3D_TMAX_TIP
-format double
}
GuidoFiller fill {
-height 1
}
GuidoFiller fill {
-height 1
}
GuidoFileBrowserField output_string_file_location {
-display_length 26
-file_mask *.str
-link output_string_file_id output_string_file_ext
-format none
-input true
-label "Output location"
-max_length 252
-null false
-tip "The file location to use for output files."
}
GuidoPanel anonymous {
-layout CentreLineLayout
-height 1
-input false
GuidoField output_string_file_id {
-display_length 1
-format none
-input true
-max_length 16
-null true
}
GuidoField output_string_file_ext {
-display_length 1
-format none
-input true
-max_length 16
-null true
}
}
GuidoFiller fill {
-height 1
}
GuidoCheckBox remove_intermediate_files {
-label "Clean up"
-default true
-tip GSLIB_IK3D_CLEANUP_TIP
}
}
GuidoPanel anonymous {
-layout BoxLayout Y_AXIS
-label Transformation
-width 64
GuidoPanel anonymous {
-layout BoxLayout Y_AXIS
-width 52
GuidoPanel anonymous {
-layout CentreLineLayout
GuidoCheckBox reference {
-label "Smooth the distribution"
-default false
-tip GSLIB_SGSIM_SMOOTH_TIP
}
}
GuidoFiller fill {
-height 0.1
}
GuidoPanel anonymous {
-layout BoxLayout X_AXIS
-dependency {"[$reference getCurrentValue]" == "true"}
GuidoPanel anonymous {
-layout CentreLineLayout
GuidoComboBox scaling {
-display_length 9
-exclusive true
-label "Scaling type"
-null false
-tip GSLIB_SGSIM_SCALING_TIP
-value_in 0 1
-alternative_values "Arithmetic (0)" "Logarithmic (1)"
-default 1
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoFiller fill {
-height 0.5
}
GuidoFiller fill {
-height 0.5
}
GuidoField nz {
-display_length 6
-label "Number of Z values"
-default 100
-null false
-tip GSLIB_SGSIM_NZ_TIP
-format integer
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField zmin {
-display_length 6
-label "Minimum Z"
-default 0.0
-null false
-tip GSLIB_SGSIM_ZMIN_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField zmax {
-display_length 6
-label "Maximum Z"
-default 1.0
-null false
-tip GSLIB_SGSIM_ZMAX_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true"}
-next_focus maxpert
}
GuidoFiller fill {
-height 0.5
}
GuidoFiller fill {
-height 0.5
}
GuidoField smoothing_window_size {
-label "Smoothing window size"
-display_length 6
-format integer
-max_length 16
-null false
-tip GSLIB_SGSIM_WINDOW_TIP
-dependency {"[$reference getCurrentValue]" == "true"}
-default 5
}
GuidoFiller fill {
-height 0.5
}
GuidoFiller fill {
-height 0.5
}
GuidoLabel closeness_to {
-label "Closeness to"
-height 1
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoPanel anonymous {
-layout CentreLineLayout
GuidoFiller unused {
-width 2
}
GuidoLabel weight {
-label "Weight"
-dependency {"[$reference getCurrentValue]" == "true"}
}
}
GuidoLabel close_mean_label {
-label "target mean"
-height 1
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoPanel anonymous {
-layout BoxLayout X_AXIS
GuidoCheckBox close_mean {
-default false
-tip GSLIB_SGSIM_CLOSE_MEAN_TIP
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField mean_weight {
-display_length 6
-default 1
-null false
-tip GSLIB_SGSIM_MEAN_WGT_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true" && "[$close_mean getCurrentValue]" == "true"}
-height 1
}
}
GuidoLabel close_variance_label {
-label "target variance"
-height 1
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoPanel anonymous {
-layout BoxLayout X_AXIS
GuidoCheckBox close_variance {
-default false
-tip GSLIB_SGSIM_CLOSE_VARIANCE_TIP
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField variance_weight {
-display_length 6
-default 1
-null false
-tip GSLIB_SGSIM_VARIANCE_WGT_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true" && "[$close_variance getCurrentValue]" == "true"}
-height 1
}
}
GuidoLabel close_smoothness_label {
-label "target smoothness"
-height 1
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoPanel anonymous {
-layout BoxLayout X_AXIS
GuidoCheckBox close_smoothness {
-default false
-tip GSLIB_SGSIM_CLOSE_SMOOTHNESS_TIP
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField smoothness_weight {
-display_length 6
-default 2
-null false
-tip GSLIB_SGSIM_SMOOTHNESS_WGT_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true" && "[$close_smoothness getCurrentValue]" == "true"}
-height 1
}
}
GuidoLabel close_quantiles_label {
-label "specified quantiles"
-height 1
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoPanel anonymous {
-layout BoxLayout X_AXIS
GuidoCheckBox close_quantiles {
-default false
-tip GSLIB_SGSIM_CLOSE_QUANTILES_TIP
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField quantile_weight {
-display_length 6
-default 2
-null false
-tip GSLIB_SGSIM_QUANTILES_WGT_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true" && "[$close_quantiles getCurrentValue]" == "true"}
-height 1
-next_focus specify_mean
}
}
GuidoFiller fill {
-height 0.5
}
GuidoFiller fill {
-height 0.5
}
}
GuidoFiller fill {
-width 1
}
GuidoPanel anonymous {
-layout BoxLayout Y_AXIS
GuidoPanel anonymous {
-layout CentreLineLayout
GuidoFiller fill {
-height 1
}
GuidoFiller fill {
-height 1
}
GuidoFiller fill {
-height 0.5
}
GuidoFiller fill {
-height 0.5
}
GuidoField maxpert {
-display_length 6
-label "Max Perturbations"
-default 750
-null false
-tip GSLIB_SGSIM_MAXPERT_TIP
-format integer
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField report {
-display_length 6
-label "Report after"
-default 50
-null false
-tip GSLIB_SGSIM_REPORT_TIP
-format integer
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField omin {
-display_length 6
-label "Min objective"
-default 0.0001
-null false
-tip GSLIB_SGSIM_OBJECTIVE_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true"}
-next_focus smoothing_window_size
}
GuidoLabel anonymous {
-label "Seed"
-height 1
}
GuidoPanel anonymous {
-layout CentreLineLayout
GuidoField seed {
-display_length 6
-default 1
-null false
-tip GSLIB_SGSIM_SEED_TIP
-format integer
}
GuidoButton button {
-height 1
-caption "Generate seed"
-action valueChanged {[getSeed $seed]}
-tip GSLIB_SGSIM_MAKE_SEED_TIP
}
}
GuidoFiller fill {
-height 2.3
}
GuidoFiller fill {
-height 2.3
}
GuidoLabel mean_label {
-label "Specify mean"
-height 1
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoPanel anonymous {
-layout BoxLayout X_AXIS
GuidoCheckBox specify_mean {
-default false
-tip GSLIB_SGSIM_SPECIFY_MEAN_TIP
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField use_mean {
-display_length 6
-default 2
-null false
-tip GSLIB_SGSIM_SPECIFY_MEAN_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true" && "[$specify_mean getCurrentValue]" == "true"}
-height 1
}
}
GuidoLabel variance_label {
-label "Specify variance"
-height 1
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoPanel anonymous {
-layout BoxLayout X_AXIS
GuidoCheckBox specify_variance {
-default false
-tip GSLIB_SGSIM_SPECIFY_VARIANCE_TIP
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField use_variance {
-display_length 6
-default 2
-null false
-tip GSLIB_SGSIM_SPECIFY_VARIANCE_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true" && "[$specify_variance getCurrentValue]" == "true"}
-height 1
-next_focus ndq
}
}
GuidoFiller filler {
-height 1.1
}
GuidoFiller filler {
-height 1.1
}
GuidoField ndq {
-label "Quantiles from data"
-display_length 6
-format integer
-max_length 16
-null false
-tip GSLIB_SGSIM_QUANTILES_TIP
-dependency {"[$reference getCurrentValue]" == "true"}
-default 5
-next_focus nuqs
}
GuidoLabel anonymous {
-label "User defined quantiles"
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoScrollPane cdf_scroll {
-scroll_size 18 5
GuidoTable nuqs {
-instances $nuqs_rows 1 100
-interactive true
-dependency {"[$reference getCurrentValue]" == "true"}
GuidoField cdf {
-label cdf
-display_length 5
-default 0.0
-null false
-tip GSLIB_SGSIM_USER_QUANTILES_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true"}
}
GuidoField z {
-label z
-display_length 5
-default 0.0
-null false
-tip GSLIB_SGSIM_USER_QUANTILES_TIP
-format double
-dependency {"[$reference getCurrentValue]" == "true"}
}
}
}
}
}
}
}
}
}
}
getSeed $seed
set formStatus [$NSCOREParameters interact]
if {$formStatus == "apply"} {
GuidoApp appHandle "BM GSLIB NSCORE"
$output_string_file_id setCurrentValue [$string_file_id getCurrentValue]
$appHandle setParam string_file_location [$string_file_location getCurrentValue]
$appHandle setParam string_file_id [$string_file_id getCurrentValue]
$appHandle setParam range [$range getCurrentValue]
$appHandle setParam field [$field getCurrentValue]
$appHandle setParam weight_field [$weight_field getCurrentValue]
$appHandle setParam tmin [$tmin getCurrentValue]
$appHandle setParam tmax [$tmax getCurrentValue]
$appHandle setParam remove_intermediate_files [$remove_intermediate_files getCurrentValue]
$appHandle setParam output_string_file_location [$output_string_file_location getCurrentValue]
$appHandle setParam reference [$reference getCurrentValue]
if {"[$reference getCurrentValue]" == "true"} {
$appHandle setParam nz [$nz getCurrentValue]
$appHandle setParam zmin [$zmin getCurrentValue]
$appHandle setParam zmax [$zmax getCurrentValue]
$appHandle setParam scaling [$scaling getCurrentValue]
$appHandle setParam maxpert [$maxpert getCurrentValue]
$appHandle setParam report [$report getCurrentValue]
$appHandle setParam omin [$omin getCurrentValue]
$appHandle setParam seed [$seed getCurrentValue]
$appHandle setParam close_mean [$close_mean getCurrentValue]
$appHandle setParam mean_weight [$mean_weight getCurrentValue]
$appHandle setParam close_variance [$close_variance getCurrentValue]
$appHandle setParam variance_weight [$variance_weight getCurrentValue]
$appHandle setParam close_smoothness [$close_smoothness getCurrentValue]
$appHandle setParam smoothness_weight [$smoothness_weight getCurrentValue]
$appHandle setParam close_quantiles [$close_quantiles getCurrentValue]
$appHandle setParam quantile_weight [$quantile_weight getCurrentValue]
$appHandle setParam smoothing_window_size [$smoothing_window_size getCurrentValue]
$appHandle setParam ndq [$ndq getCurrentValue]
$appHandle setParam specify_mean [$specify_mean getCurrentValue]
if {[$specify_mean getCurrentValue]} {
$appHandle setParam use_mean [$use_mean getCurrentValue]
}
$appHandle setParam specify_variance [$specify_variance getCurrentValue]
if {[$specify_variance getCurrentValue]} {
$appHandle setParam use_variance [$use_variance getCurrentValue]
}
for {set row_idx 0} {$row_idx < [$nuqs getRowCount]} {incr row_idx} {
$appHandle setParam "cdf\($row_idx\)" [$cdf getCurrentValue $row_idx]
$appHandle setParam "z\($row_idx\)" [$z getCurrentValue $row_idx]
}
}
$appHandle invoke
$appHandle destroy
}
$NSCOREParameters destroy
