/****************************************************************/
/*  au_prof1d_calibo1p1           13.06.2012                    */
/****************************************************************/
/*  Short Description :                                         */
/*  AU program for 1D data acquisition.                         */
/****************************************************************/
/*  Keywords :                                                  */
/*  zg,profiling,water suppression                              */
/****************************************************************/
/*  Description/Usage :                                         */
/*  Modification of Bruker AU au_prof1d to allow calibo1p1      */
/*  program to be used in automation without overwriting        */
/*  experiment parameters.	        			*/
/*  AU program for data acquisition with baselinefilter.        */
/*  The lockphase is optimized, water suppression offset is     */
/*  optimized, and a pulse calibration is performed.	      	*/
/****************************************************************/
/*  Author(s) :                                                 */
/*  Name            : Todd Rappe                                */
/*  Organisation    : University of Minnesota                   */
/*  Email           : rapp0006@umn.edu				*/
/****************************************************************/
/*  Name        Date    Modification:				*/
/*  tmr			    120612	renamed and calibo1p1 added */
/*  eub         070110  created                                 */
/*  rke         070716  save parameters                         */
/****************************************************************/
/*
$Id: au_prof1d_calibo1p1,v 1.6 2010/06/13 09:11:18 tmr Exp $
*/

// variables
int orig_expno, orig_procno;
double o1opt;
float p1opt, pl1opt;
orig_expno=expno;
orig_procno=procno;
char cmdtext[256];

GETCURDATA

// optimize lockphase
AUTOPHASE;

// change to experiment 9888 for calibrations
DATASET (name,9888,procno,disk,user)

// determine 90deg pulse automatically, and optimize 1H offset, O1, 
// for water suppression with no display of results
// ATTENTION: pulse calibration starts with PROSOL values
// current values are IGNORED

XCMD("calibo1p1.fast");

// transfer optimized parameters to original experiment and
// execute getprosol with new values
FETCHPAR("O1", &o1opt);
FETCHPAR("P 1", &p1opt);
FETCHPAR("PLdB 1", &pl1opt);

DATASET (name,orig_expno,orig_procno,disk,user);
STOREPAR("O1", o1opt);
sprintf(cmdtext, "getprosol 1H %f %f", p1opt, pl1opt);
JAVACALL(cmdtext);

// run experiment
RGA;
ZG;

QUIT
