#include /* modified 2Dsplit and conv2bin au scripts here to print out all the rows in a pseudo 2D file. it is saved in the dir called from under '2d.txt' file in xmgr format (ie separated by & */ int slices, si, tprocno; char infile[PATH_MAX], outfile[PATH_MAX], outfile2[PATH_MAX], *inbuf1; int *inbufint1, pparmode, i, fpin, intens, bytordp; unsigned bytetoread; float offset, hzppt; double sf, swp, hz, ppm, hzoffset, ppmppt; FILE *fpout, *fp; GETCURDATA FETCHPAR1S("SI",&si) strcpy(text,"r"); GETINT("Enter the number of slices to read : ",slices) tprocno=procno+1; FETCHPARS("PPARMOD",&pparmode); /* (void)sprintf(outfile,"/opt/topspin3.5pl7/data/%s/nmr/%s/%d/pdata/%d/junk.txt",disk,user,name,expno,procno); (void)sprintf(outfile2,"/opt/topspin3.5pl7/data/%s/nmr/%s/%d/2d.txt",disk,user,name,expno); */ (void)sprintf(outfile,"%s/%s%s/%d/pdata/%d/junk.txt", disk,user,name,expno,procno); (void)sprintf(outfile2,"%s/%s%s/%d/pdata/2d.txt", disk,user,name,expno); fp = fopen (outfile2, "w+"); for (i1=1;i1<=slices;i1++) { RSR(i1,i1+tprocno-1) FETCHPARS("BYTORDP",&bytordp); FETCHPARS("SI",&si); FETCHPARS("OFFSET",&offset); FETCHPARS("SF",&sf); FETCHPARS("SW_p",&swp); FETCHPARS("HZpPT",&hzppt); ppmppt=(double)hzppt/sf; hzoffset=(double)offset*sf; bytetoread = si*sizeof(int); /* (void)sprintf(infile,"/opt/topspin/data/%s/nmr/%s/%d/pdata/%d/1r", disk,user,name,expno,i1+tprocno-1); */ (void)sprintf(infile,"%s/%s%s/%d/pdata/%d/1r", disk,user,name,expno,i1+tprocno-1); if ( (fpin=open(infile,O_RDONLY)) == (-1) ) { Perror(DEF_ERR_OPT,infile); ABORT } if ( (fpout=fopen(outfile,"wb")) == NULL) { Perror(DEF_ERR_OPT,outfile); ABORT; } if ( (inbuf1 = calloc (bytetoread,sizeof(char*))) == NULL) { Perror(DEF_ERR_OPT,infile); close (fpin); fclose (fpout); ABORT } if ( (i = read (fpin,inbuf1,bytetoread)) != bytetoread ) { Perror(DEF_ERR_OPT,infile); fclose (fpout); close (fpin); ABORT } close(fpin); local_swap4(inbuf1,bytetoread,bytordp); inbufint1 = (int *)inbuf1; for (i=0; i < si; i++) { intens=inbufint1[i]; ppm=offset-ppmppt*(i+0.5); hz=hzoffset-hzppt*(i+0.5); fprintf(fp,"%.4f %d\n",ppm, intens); } fprintf(fp,"%s\n", "&"); } fclose(fpout); fclose(fp); QUITMSG (" --2D.txt file stored under filename/expno -- ")