/***********************************************-*-C++-*-********/
/*	proc_1dapks			29.12.1998		*/
/****************************************************************/
/*	Short Description :					*/
/* 	Processes and plot 1D spectra. Uses 'apks' for phase 	*/
/* 	correction and 'autoplot' for plotting. 		*/
/****************************************************************/
/*	Keywords :						*/
/*	1D, autoplot, XWIN-PLOT,apks				*/
/****************************************************************/
/*	Description/Usage :					*/
/*	Basic processing AU program for 1D spectra, plotting 	*/
/*	with XWIN-PLOT.This AU program works like proc_1d, 	*/
/*	but uses apks.						*/
/*	Performs ef, apks, sref, abs and autoplot. If you want	*/
/*	to use your individual XWIN-PLOT  			*/
/*	layout, you can define it in XWIN-NMR with the command 	*/
/*	'edo'. If there is none, the default layout 		*/
/*	'1D_X.xwp' is used.					*/
/*	Peak Picking will be done in the acquisition range	*/
/****************************************************************/
/*	Author(s) :						*/
/*	Name		: Kim Colson				*/
/*	Organisation	: Bruker BioSpin Corp.			*/
/*	Email		: kim.colson@bruker-biospin.com		*/
/*								*/
/*	Name		: Peter Dvortsak,Mike Engelhardt	*/
/*			  Sven Cunskis, Sven Augner		*/
/*	Organisation	: Bruker BioSpin GmbH			*/
/*	Email		: nmr-software-support@bruker.de	*/
/****************************************************************/
/*	Name		Date	Modification:			*/
/*	klc,pdv,eng	981229	created				*/
/*	svcu		010103	use XWIN-PLOT for plotting	*/
/*	svcu		041001	increase print_to_file options	*/
/*	augn		070418	XWP_PP replaced with PP		*/
/*								*/
/****************************************************************/
/*
$Id:$
*/

/*********************************************/
/* Declare variables */
double sf, sw_p;
double f1p, f2p, f1porig, f2porig;
float offset;
char xwlay[PATH_MAX], portf[PATH_MAX];

portf[0] = 0;

/*********************************************/
/* processing */
EF
ERRORABORT
APKS
SREF
ABS

/*********************************************/
/* If no TopSpin PLOT Editor layout is defined	*/
/* the default layout will be used	*/
FETCHPAR("LAYOUT",&xwlay)
if (xwlay[0] == '\0') 
{
    STOREPAR("LAYOUT","+/1D_X.xwp")
}

/*********************************************/
/* store the current plotregion */
FETCHPAR("F1P",&f1porig)
FETCHPAR("F2P",&f2porig)

/*********************************************/
/* define the plotregion as big as */
/* the complete acquisition region */
FETCHPARS("OFFSET",&offset)
FETCHPARS("SW_p",&sw_p)
FETCHPARS("SF",&sf)
f1p = offset;
f2p = f1p - sw_p / sf;
STOREPAR("F1P",f1p)
STOREPAR("F2P",f2p)

/*********************************************/
/* create the pick picking listing for TopSpin PLOT Editor */
PP

/*********************************************/
/* restore the original plotregion */
STOREPAR("F1P",f1porig)
STOREPAR("F2P",f2porig)

AUTOPLOT


/*********************************************/
/* Adds include file 'printtofile' that manage */
/* the print to file information	*/

#include <inc/printtofile>


QUIT
