-
Notifications
You must be signed in to change notification settings - Fork 3
/
PCSA_1.php
319 lines (267 loc) · 8.38 KB
/
PCSA_1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<?php
/*
* PCSA_1.php
*
* A place to start entering submission parameters for the PCSA analysis
*
*/
include_once 'checkinstance.php';
elogrsp( __FILE__ );
if ( ($_SESSION['userlevel'] != 2) &&
($_SESSION['userlevel'] != 3) &&
($_SESSION['userlevel'] != 4) &&
($_SESSION['userlevel'] != 5) ) // only data analyst and up
{
if ( $is_cli ) {
$errstr = "ERROR: " . __FILE__ . " user level is insufficient";
echo "$errstr\n";
$cli_errors[] = $errstr;
return;
}
header('Location: index.php');
exit();
}
// Verify that job submission is ok now
include_once 'lib/motd.php';
if ( motd_isblocked() && ($_SESSION['userlevel'] < 4) )
{
if ( $is_cli ) {
$errstr = "ERROR: " . __FILE__ . " Job submission is blocked";
echo "$errstr\n";
$cli_errors[] = $errstr;
return;
}
header("Location: index.php");
exit();
}
// Verify that there is something in the queue
if ( ! isset( $_SESSION['request'] ) || sizeof( $_SESSION['request'] ) < 1 )
{
if ( $is_cli ) {
$errstr = "ERROR: " . __FILE__ . " empty queue";
echo "$errstr\n";
$cli_errors[] = $errstr;
return;
}
header("Location: queue_setup_1.php");
exit();
}
// define( 'DEBUG', true );
include_once 'config.php';
include_once 'db.php';
include_once 'lib/utility.php';
include_once 'lib/payload_manager.php';
include_once 'lib/controls.php';
// Make sure the advancement level is set
$advanceLevel = ( isset($_SESSION['advancelevel']) )
? $_SESSION['advancelevel'] : 0;
$separate_datasets = ( isset( $_SESSION['separate_datasets'] ) )
? $_SESSION['separate_datasets'] : 1;
$advanced_review = ( isset( $_SESSION['advanced_review' ] ) )
? $_SESSION['advanced_review' ] : 0;
// To support multiple datasets, let's keep track of which one we're on
$num_datasets = sizeof( $_SESSION['request'] );
// Create the payload manager
$payload = new Payload_PCSA( $_SESSION );
elogrsp( __FILE__ . " after new payload" );
// First, let's see if the "TIGRE" button has been pressed
if ( isset($_POST['TIGRE']) )
{
$dataset_id = $num_datasets - 1;
// Save cluster information
if ( isset($_POST['cluster']) )
{
list( $cluster_name, $cluster_shortname, $queue ) = explode(":", $_POST['cluster'] );
$gwhostid = 'uslims3';
if ( isset( $_SESSION[ 'gwhostid' ] ) )
$gwhostid = $_SESSION[ 'gwhostid' ];
list( $cluster_name, $cluster_shortname, $queue ) = explode(":", $_POST['cluster'] );
if ( preg_match( "/alamo/", $gwhostid ) && $cluster_shortname == 'alamo' )
{ // alamo-to-alamo uses alamo-local as cluster
$cluster_shortname = 'alamo-local';
}
$_SESSION['cluster'] = array();
$_SESSION['cluster']['name'] = $cluster_name;
$_SESSION['cluster']['shortname'] = $cluster_shortname;
if ( $cluster_shortname == 'jacinto' )
{
if ( isset($_SESSION['separate_datasets']) )
{
if ( $_SESSION['separate_datasets'] == 0 )
{
$queue = 'ngenseq';
}
}
if ( $num_datasets > 4 )
$queue = 'ngenseq';
}
$_SESSION['cluster']['queue'] = $queue;
}
if ( $num_datasets > 1 && $advanced_review == 0 )
{ // For multiple datasets and no advanced review, create all payloads
$payload->clear();
for ( $jdataset_id = 0; $jdataset_id < ( $num_datasets - 1 ); $jdataset_id++ )
{
$payload->acquirePostedData( $jdataset_id, $num_datasets );
}
$payload->save();
elogrsp( __FILE__ . "after payload->save() 1" );
}
// get previous payload data and add this session to it
$payload->restore();
$payload->add( 'cluster', $_SESSION['cluster'] );
$payload->acquirePostedData( $dataset_id, $num_datasets );
$payload->save();
elogrsp( __FILE__ . "after payload->save() 2" );
// Check to see if the file is too big
if ( $advanceLevel == 0 )
; // check_filesize();
// $payload->show();
if ( $is_cli ) {
$_REQUEST = [];
$_POST = [];
include "PCSA_2.php";
return;
} else {
header("Location: PCSA_2.php");
exit();
}
}
// Now let's see if the "next" button has been pressed
else if ( isset($_POST['next']) )
{
$dataset_id = ( $_POST['dataset_id'] < $num_datasets - 1 )
? $_POST['dataset_id'] : $num_datasets - 1;
// get previous payload data and add this session to it
$payload->restore();
$payload->acquirePostedData( $dataset_id, $num_datasets );
$payload->save();
elogrsp( __FILE__ . "after payload->save() 3" );
$dataset_id++;
}
// In this case it's the first time here
else
{
$dataset_id = 0;
// Add the initial options to the payload
$payload->clear();
$payload->save();
elogrsp( __FILE__ . "after payload->save() 4" );
// If multi-data and no advanced review, point to last dataset
if ( $advanced_review == 0 &&
$num_datasets > 1 )
$dataset_id = $num_datasets - 1;
}
// Get some other session data
$editMeniscus = $_SESSION['request'][$dataset_id]['editMeniscus'];
$dataLeft = $_SESSION['request'][$dataset_id]['dataLeft'];
// Start displaying page
$page_title = 'PCSA Analysis';
$css = 'css/slider.css';
$js = 'js/analysis.js,js/PCSA.js';
include 'header.php';
$new_noise = '';
if ( isset($_SESSION['edit_select_type']) &&
$_SESSION['edit_select_type'] == 0 )
{ // If latest edits and noise, reset the noises
set_latest_noises( $link );
$new_noise = $_SESSION['new_noise'];
}
?>
<!-- Begin page content -->
<div id='content'>
<h1 class="title"><?php echo $page_title; ?></h1>
<!-- Place page content here -->
<?php echo $new_noise; ?>
<div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"
onsubmit="return validate(this,
<?php echo $advanceLevel; ?>,
<?php echo $dataset_id; ?>,
<?php echo $num_datasets; ?>,
<?php echo $separate_datasets; ?>,
<?php echo $editMeniscus; ?>,
<?php echo $dataLeft; ?>);" >
<?php
// if ( isset($error) ) echo $error;
$max_dset_id = $num_datasets - 1;
$dataset_id = min( $dataset_id, $max_dset_id );
$display_dsid = ( $advanced_review == 0 ) ? 0 : $dataset_id;
display( $display_dsid, $num_datasets );
// Display some information about the current dataset
echo " <fieldset>\n" .
" <h3>Dataset control:</h3>\n" .
" <ul>\n" .
" <li>Current dataset number: " . ($dataset_id + 1) . "</li>\n" .
" <li>Run Name: {$_SESSION['request'][$dataset_id]['filename']}</li>\n" .
" <li>Number of datasets: $num_datasets</li>\n" .
" </ul>\n";
// Add some controls to move to the next dataset, if there's more than one
if ( $num_datasets > 1 && $dataset_id < $max_dset_id )
{
echo " <input type='hidden' name='dataset_id' value='$dataset_id' />\n" .
" <input class='submit' type='submit' name='next' value='Next Dataset -->' /></p>\n";
}
echo " </fieldset>\n";
if ( $dataset_id == $max_dset_id )
{
echo tigre();
}
?>
</form>
<?php $payload->show(); ?>
</div>
</div>
<?php
include 'footer.php';
if ( $is_cli ) {
echo __FILE__ . " exiting 4\n";
}
exit();
// A function to display controls for one dataset
function display( $dataset_id, $num_datasets )
{
// Get edited data profile
$parts = explode( ".", $_SESSION['request'][$dataset_id]['editFilename'] );
$edit_text = $parts[1];
echo " <fieldset>" .
" <legend>Initialize PCSA Parameters - " .
"{$_SESSION['request'][$dataset_id]['filename']}; " .
"Edit profile: $edit_text; " .
" Dataset " . ($dataset_id + 1) . " of $num_datasets</legend>\n";
if ( $dataset_id == 0 )
{
pcsa_pars_setup();
montecarlo();
if ( $num_datasets > 1 && $separate_datasets == 2 )
{
PMGC_option();
}
tinoise_option();
}
echo<<<HTML
<p><button onclick="return toggle('advanced');" id='show'>
Show Advanced Options</button></p>
<div id='advanced' style='display:none;'>
HTML;
if ( $dataset_id == 0 )
{
rinoise_option();
debug_option();
}
simpoints_input();
band_volume_input();
radial_grid_input();
time_grid_input();
echo<<<HTML
</div>
<input class="submit" type="button"
onclick='window.location="queue_setup_2.php"'
value="Edit Profiles"/>
<input class="submit" type="button"
onclick='window.location="queue_setup_1.php"'
value="Change Experiment"/>
</fieldset>
HTML;
}
?>