- Timestamp:
- Nov 24, 2010 4:31:15 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/BT5_Loader.ipf
r570 r765 51 51 Variable v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,ii,valuesRead 52 52 String buffer ="",s1,s2,s3,s4,s5,s6,s7,s8,s9,s10 53 String filen="",fileLabel="" 53 String filen="",fileLabel="",filedt="" 54 55 Variable MainDeadTime,TransDeadTime 54 56 55 57 //parse the first line … … 62 64 countTime=v1*v2 63 65 //Print "time (sec) = ",countTime 66 67 //Deadtime correction 68 //Discovered significant deadtime on detectors in Oct 2010 69 //JGB and AJJ changed pre-amps during shutdown Oct 27 - Nov 7 2010 70 //Need different deadtime before and after 8th November 2010 71 filedt = s2+" "+s3+" "+s4+" "+s5 72 ii=strlen(filedt) 73 filedt = filedt[1,(ii-2)] 74 75 print filedt 76 print BT5Date2Secs(filedt) 77 print date2secs(2010,11,7) 78 79 if (BT5Date2Secs(filedt) < date2secs(2010,11,7)) 80 MainDeadTime = 4e-5 81 TransDeadTime = 1.26e-5 82 //print "Old Dead Times" 83 //MainDeadTime = 0 84 //TransDeadTime = 0 85 else 86 MainDeadTime = 7e-6 87 TransDeadTime = 1.26e-5 88 //print "New Dead Times" 89 endif 64 90 65 91 //skip line 2 … … 91 117 //print valuesRead 92 118 MonCts[numlinesloaded] = v1 //monitor 119 v2 = v2/(1.0-V2*MainDeadTime/countTime) // Deadtime correction 120 v3 = v3/(1.0-V3*MainDeadTime/countTime) // Deadtime correction 121 v5 = v5/(1.0-V5*MainDeadTime/countTime) // Deadtime correction 122 v6 = v6/(1.0-V6*MainDeadTime/countTime) // Deadtime correction 123 v7 = v7/(1.0-V7*MainDeadTime/countTime) // Deadtime correction 93 124 DetCts[numlinesloaded] = v2 + v3 + v5 + v6 + v7 //5 detectors 94 TransCts[numlinesloaded] = v4 //trans detector125 TransCts[numlinesloaded] = v4/(1.0-V4*TransDeadTime/countTime) //trans detector+deadtime correction 95 126 ErrDetCts[numlinesloaded] = sqrt(detCts[numlinesloaded]) 96 127 //values 8-16 are always zero … … 249 280 return(0) 250 281 End 282 283 284 Function BT5DateTime2Secs(datestring) 285 String datestring 286 287 Variable bt5secs 288 289 String monthnums = "Jan:1;Feb:2;Mar:3;Apr:4;May:5;Jun:6;Jul:7;Aug:8;Sep:9;Oct:10;Nov:11;Dec:12" 290 291 Variable bt5month = str2num(StringByKey(stringfromlist(0,datestring, " "),monthnums)) 292 Variable bt5day = str2num(stringfromlist(1,datestring," ")) 293 Variable bt5year = str2num(stringfromlist(2,datestring," ")) 294 Variable bt5hours = str2num(stringfromlist(0,stringfromlist(3,datestring," "),":")) 295 Variable bt5mins = str2num(stringfromlist(1,stringfromlist(3,datestring," "),":")) 296 297 bt5secs = date2secs(bt5year,bt5month,bt5day) + 3600*bt5hours + 60*bt5mins 298 299 return bt5secs 300 End 301 302 Function BT5Date2Secs(datestring) 303 String datestring 304 305 Variable bt5secs 306 307 String monthnums = "Jan:1;Feb:2;Mar:3;Apr:4;May:5;Jun:6;Jul:7;Aug:8;Sep:9;Oct:10;Nov:11;Dec:12" 308 309 Variable bt5month = str2num(StringByKey(stringfromlist(0,datestring, " "),monthnums)) 310 Variable bt5day = str2num(stringfromlist(1,datestring," ")) 311 Variable bt5year = str2num(stringfromlist(2,datestring," ")) 312 313 bt5secs = date2secs(bt5year,bt5month,bt5day) 314 315 return bt5secs 316 End
Note: See TracChangeset
for help on using the changeset viewer.