Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
LAMP
Commits
bd9738fd
Commit
bd9738fd
authored
May 14, 2019
by
Gonzalez, Miguel
Browse files
Modifications to improve the handling of Salsa files after 2014 (Issue 27)
parent
e66b8d78
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
lamp_mac/SALSA/salsa_combine_ws.pro
0 → 100644
View file @
bd9738fd
function
salsa_combine_ws
,
wks_list
;
get
array
with
list
of
workspaces
wks_list
=
fix
(
strsplit
(
wks_list
,
','
,
/
extract
))
nwks
=
n_elements
(
wks_list
)
;
first
go
through
all
workspaces
,
check
that
they
are
3
D
(
Salsa
scans
),
;
and
create
list
of
unique
Z
parameters
zpar
=
[]
for
i
=
0
,
nwks
-
1
do
begin
take_w
,
wtmp
,
w
=
wks_list
[
i
]
sz
=
size
(
wtmp
)
if
sz
[
0
]
ne
3
then
begin
txterr
=
'This routine operates only with 3D numors. Exiting!'
print
,
txterr
lamp_message
,
txterr
lamp_journal
,
txterr
return
,
0
endif
else
begin
take_datp
,
pstruct
,
w
=
wks_list
[
i
]
zpar
=
[
zpar
,
pstruct
.
z
]
endelse
endfor
;
convert
float
values
to
integer
(
after
multiplying
by
1000
)
to
search
unique
values
;
z_out
contains
the
output
values
,
zcomp
the
values
to
compare
(
integers
or
strings
)
if
typename
(
zpar
)
eq
'FLOAT'
then
begin
zpar
=
fix
(
zpar
*
1000
)
zcomp
=
zpar
[
uniq
(
zpar
,
sort
(
zpar
))]
z_out
=
zpar
[
uniq
(
zpar
,
sort
(
zpar
))]
/
1000
.
endif
else
begin
z_out
=
zpar
[
uniq
(
zpar
,
sort
(
zpar
))]
zcomp
=
z_out
endelse
;
set
dimensions
of
output
arrays
npts
=
n_elements
(
z_out
)
w_out
=
fltarr
(
sz
[
1
],
sz
[
2
],
npts
)
n_out
=
fltarr
(
1
,
1
,
npts
)
pv_out
=
fltarr
(
n_elements
(
pstruct
.
pv
[
*,
0
]),
npts
)
counter
=
intarr
(
npts
)
;
re
-
read
all
workspaces
and
sum
them
for
i
=
0
,
nwks
-
1
do
begin
take_w
,
wtmp
,
w
=
wks_list
[
i
]
take_datp
,
pstruct
,
w
=
wks_list
[
i
]
if
i
eq
0
then
begin
;
set
non
-
scan
variables
from
1
st
workspace
x_out
=
pstruct
.
x
endif
else
begin
;
check
that
2
-
theta
angles
are
the
same
for
all
workspaces
if
n_elements
(
x_out
)
ne
n_elements
(
pstruct
.
x
)
then
begin
txterr
=
'Different X dimensions. Exiting!'
print
,
txterr
lamp_message
,
txterr
lamp_journal
,
txterr
return
,
0
endif
diff
=
abs
(
x_out
-
pstruct
.
x
)
if
max
(
diff
)
gt
1
.
e
-
3
then
begin
txterr
=
'X values in workspace '
+
strtrim
(
wks_list
[
i
],
2
)
+
$
' are different from those in workspace '
+
strtrim
(
wks_list
[
0
],
2
)
+
$
'. Exiting!'
print
,
txterr
lamp_message
,
txterr
lamp_journal
,
txterr
return
,
0
endif
endelse
;
check
Z
values
and
sum
together
equivalent
points
zval
=
pstruct
.
z
if
typename
(
zval
)
eq
'FLOAT'
then
begin
zval
=
fix
(
zval
*
1000
)
zval
=
zval
[
uniq
(
zval
,
sort
(
zval
))]
endif
for
j
=
0
,
n_elements
(
zval
)
-
1
do
begin
idx
=
where
(
zcomp
eq
zval
[
j
])
w_out
[
*,*,
idx
]
+=
wtmp
[
*,*,
j
]
n_out
[
*,*,
idx
]
+=
pstruct
.
n
[
*,*,
j
]
pv_out
[
*,
idx
]
+=
pstruct
.
pv
[
*,
j
]
counter
[
idx
]
+=
1
endfor
endfor
;
list
with
PV
parameters
that
should
be
added
;
0
:
time
;
1
:
monitor1
;
2
:
Total
cts
;
19
:
monitor
2
additive_params
=
[
0
,
1
,
2
,
19
]
for
i
=
0
,
n_elements
(
pv_out
[
*,
0
])
-
1
do
begin
test
=
where
(
additive_params
eq
i
,
count
)
if
count
eq
0
then
pv_out
[
i
,
*
]
/=
counter
;
non
-
additive
parameter
,
calculate
average
endfor
;
set
errors
as
sqrt
(
counts
)
e_out
=
sqrt
(
w_out
)
;
return
combined
workspace
and
parameters
pstruct
.
other_tit
=
'Combined wks. Last: '
+
pstruct
.
other_tit
mod_datp
,
pstruct
,
'Z'
,
z_out
mod_datp
,
pstruct
,
'N'
,
n_out
mod_datp
,
pstruct
,
'E'
,
e_out
mod_datp
,
pstruct
,
'PV'
,
pv_out
give_datp
,
pstruct
return
,
w_out
end
\ No newline at end of file
lamp_mac/rdid.pro
View file @
bd9738fd
This diff is collapsed.
Click to expand it.
lamp_mac/str_fit.pro
View file @
bd9738fd
...
...
@@ -8638,11 +8638,11 @@ if strpos(ptxt[0],'#F ') eq 0 then begin
endelse
endif
;SALSA
if strpos(ptxt[0],'
2
*
Th
') eq 0 then begin
;SALSA
--> Firt parameter written either as 2*Theta (before 2019) or 0) 2*Theta
if strpos(ptxt[0],'
2
*
Th
') eq 0
or strpos(ptxt[0],'
2
*
Th
') eq 3
then begin
idx=0 & ido=1 & idt=0
for i=0,n_elements(ptxt)-1 do begin
if strpos(ptxt[i],'
X_translation
') eq 0 then idx=i
if strpos(ptxt[i],'
X_translation
') eq 0
or strpos(ptxt[i],'
X_translation
') eq 3
then idx=i
if idx gt 0 then inst='
SALSA
'
endfor
if idx gt 0 then if (size(datp.pv))[1] eq n_elements(datp.p) then begin
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment