-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakedelaylist
94 lines (80 loc) · 2.78 KB
/
makedelaylist
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
/*** ^^A -*-C++-*- **********************************************/
/* makevdlist 18.05.2000 */
/****************************************************************/
/* Short Description : */
/* makes vdlist and vclist from a sampling schedule */
/****************************************************************/
/* Keywords : */
/* nonuniform sampling */
/****************************************************************/
/* Description/Usage : */
/* xau makevdlist */
/****************************************************************/
/* Author(s) : */
/* Name : Katie Edmonds */
/* Organisation : Harvard Medical School */
/* Email : [email protected] */
/****************************************************************/
/* Name Date Modification: */
/* kae 110831 created */
/****************************************************************/
/*
$Id: makevdlist,v 0.1 2011/08/31 $
*/
AUERR = makevdlist(curdat);
QUIT
/*#include <stdio.h>*/
int makevdlist(const char* curdat)
{
/*float sw1,sw2,sw3;*/
float inf2,inf3,in0,in10,nd0,nd10;
float d0,d10;
FILE *ifp,*ofp;
int index1,index2;
char line[PATH_MAX], vdpath[PATH_MAX], vdlistname[32];
char * message;
nd0=2.0;
nd10=2.0;
/*FETCHPAR("SWH", &sw1);
FETCHPAR1("SWH", &sw2);
FETCHPAR3("SWH", &sw3);*/
FETCHPAR1("IN_F", &inf2);
FETCHPAR3("IN_F", &inf3);
/* Calculate the delay increment based on nd0 (number of times d0 would
appear in each scan of the pulse sequence). The factor of 1,000,000
corrects for the fact that inf1 and inf2 are expressed in microseconds,
while the incremented delay is expressed in seconds. */
in0=inf2/(nd0*1000000.0);
in10=inf3/(nd10*1000000.0);
message = malloc(200*sizeof(char));
sprintf(message,"Using nd0=nd10=2, the delay increments are:\nin0=%.8fs, in10=%.8fs\n\nPlease specify a name for the variable delay list:",in0,in10);
strncpy(vdlistname,"delays",32);
GETSTRING(message,vdlistname);
if (getParfileDirForWrite(vdlistname, VD_DIRS, vdpath) < 0)
{
Proc_err(DEF_ERR_OPT, "%s: %s", vdlistname, VD_DIRS);
ABORT;
}
if ((ofp = fopen(vdpath, "wt")) == 0)
{
Proc_err(DEF_ERR_OPT, "Cannot open file for writing:\n%s", vdpath);
ABORT;
}
ifp=fopen("/opt/topspin3.1/data/katie/nmr/b800-13Cnoesy/7/complete", "r");
/*ofp=fopen("/opt/topspin3.1/data/katie/nmr/b800-13Cnoesy/7/complete_delays","w");*/
if (ifp == NULL){
Proc_err(DEF_ERR_OPT,"Can't open input file.");
exit(1);
}
/*fprintf(ofp,"%.8f %.8f\n",in0,in10);*/
while (fgets(line,sizeof(line),ifp) != NULL) {
sscanf(line,"%d %d",&index1,&index2);
d0=in0*index1;
d10=in10*index2;
fprintf(ofp,"%.7f\n%.7f\n", d0,d10);
}
fclose(ifp);
fclose(ofp);
STOREPAR("VDLIST",vdlistname);
return 0;
}