89function /s
pmsco_save_scan(pathname, filename, energy, theta, phi, alpha, intensity, sigma, [sdfr])
103 dfref savedf = GetDataFolderDFR()
104 dfref tempdf = NewFreeDataFolder()
106 if (ParamIsDefault(sdfr))
110 wave w_intensity = $intensity
111 string wavenames = ""
113 wavenames =
save_scan_helper("w_energy", energy, w_intensity, tempdf, wavenames)
114 wavenames =
save_scan_helper("w_theta", theta, w_intensity, tempdf, wavenames)
116 wavenames =
save_scan_helper("w_alpha", alpha, w_intensity, tempdf, wavenames)
117 wavenames =
save_scan_helper("w_intensity", intensity, w_intensity, tempdf, wavenames)
118 wavenames =
save_scan_helper("w_sigma", sigma, w_intensity, tempdf, wavenames)
121 save /b /g /m="\n" /p=$pathname wavenames as filename
135 if (strlen(value) > 0)
136 if (exists(value) == 1)
137 duplicate $value, destdfr:$destname
138 wave /sdfr=destdfr w=$destname
140 duplicate template, destdfr:$destname
141 wave /sdfr=destdfr w=$destname
142 variable numval = str2num(value)
144 if (numtype(numval) == 0)
150 w = DimOffset(template, 0) + DimDelta(template, 0) * p
153 w = DimOffset(template, 1) + DimDelta(template, 1) * q
156 w = DimOffset(template, 2) + DimDelta(template, 2) * r
159 w = DimOffset(template, 3) + DimDelta(template, 3) * s
163 sprintf msg, "invalid %s argument", StringFromList(1, destname, "_")
168 wavenames = AddListItem(destname, wavenames, ";", inf)
169 variable npts = DimSize(w, 0) * max(DimSize(w, 1), 1) * max(DimSize(w, 2), 1) * max(DimSize(w, 3), 1)
170 Redimension /n=(npts) w
210 variable is_modulation
213 if (ParamIsDefault(quiet))
217 loadwave /p=$pathname /a /g /o /q filename
219 if (ParamIsDefault(is_modulation))
220 is_modulation = StringMatch(s_filename, "*.modf.*")
222 is_modulation = is_modulation > 0
228 fileext = StringFromList(ItemsInList(s_filename, ".") - 1, s_filename, ".")
229 variable nw = ItemsInList(s_wavenames)
232 for (iw = 0; iw < nw; iw += 1)
233 sw1 = StringFromlist(iw, s_wavenames)
234 strswitch(fileext[iw])
258 duplicate /o $sw1, $sw2
260 waves = AddListItem(sw2, waves, ",", inf)
291 if (ParamIsDefault(quiet))
296 loadwave /p=$pathname /a /w /g /o /q filename
298 loadwave /p=$pathname /a /w /g /o filename
324 string cis = "N=at;N=xx;N=yy;N=zz;"
325 LoadWave /A /B=cis /J /K=0 /L={0, 2, 0, 0, 0} /V={
" ",
" ", 0, 0} /O /P=$pathname filename
327 at = unpadstring(at, 32)
336 if (strlen(pathname) > 0)
337 HDF5OpenFile /P=pathname /R /Z fid as filename
339 HDF5OpenFile /R /Z fid as filename
343 HDF5LoadData /N=$wname /O /Q /Z fid, "alm"
346 wave alm_r = $(wname + "_r")
347 wave alm_i = $(wname + "_i")
348 make /c /n=(dimsize(alm_r, 0), dimsize(alm_r, 1)) /o $wname
350 alm = cmplx(alm_r, alm_i)
351 variable lmax = (dimsize(alm, 0) - 1) * 2
352 setscale /i x 0, lmax, "l", alm, alm_r, alm_i
353 setscale /i y -lmax, lmax, "m", alm, alm_r, alm_i
static string save_scan_helper(string destname, string value, wave template, dfref destdfr, string wavenames)
helper function for save_pmsco_scan()
string load_pmsco_scan(string pathname, string filename, variable is_modulation=defaultValue, variable quiet=defaultValue)
load a PMSCO scan file into the current data folder.
string pmsco_save_scan(string pathname, string filename, string energy, string theta, string phi, string alpha, string intensity, string sigma, dfref sdfr=defaultValue)
save waves in a PMSCO scan data file.