Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ixstools
xrstools
Commits
adab0a7f
Commit
adab0a7f
authored
Dec 07, 2020
by
christoph
Browse files
small bug fixes
parent
5a39cd57
Changes
4
Hide whitespace changes
Inline
Side-by-side
XRStools/roifinder_and_gui.py
View file @
adab0a7f
...
...
@@ -1975,11 +1975,11 @@ class roi_finder:
ax1
.
legend
([
'Row No. %02d / %02d'
%
(
1
,
rw_data
[
roi_keys
[
0
]].
shape
[
1
])],
frameon
=
False
,
loc
=
1
,
fontsize
=
'x-small'
)
# plot the very first mask image
ax2
.
plot
([
-
0.5
,
data_dict_norm
[
'ROI00'
].
shape
[
0
]
+
0.5
,
data_dict_norm
[
'ROI00'
].
shape
[
0
]
+
0.5
,
-
0.5
],
ax2
.
plot
([
-
0.5
,
data_dict_norm
[
'ROI00'
].
shape
[
2
]
+
0.5
,
data_dict_norm
[
'ROI00'
].
shape
[
2
]
+
0.5
,
-
0.5
],
[
-
0.5
,
-
0.5
,
0.5
,
0.5
],
'k-'
)
ax2
.
imshow
(
np
.
sum
(
data_dict_norm
[
'ROI00'
],
axis
=
0
),
interpolation
=
interpolation
,
cmap
=
cmap
)
ax2
.
imshow
(
red_rois_copy
[
roi_keys
[
0
]][
1
],
interpolation
=
interpolation
,
cmap
=
'Greys'
,
alpha
=
0.5
)
# plotter
def
plot_all
(
roi_ind
,
row_ind
,
red_mask
,
row_max
):
fig
.
canvas
.
flush_events
()
...
...
XRStools/xrs_calctools.py
View file @
adab0a7f
...
...
@@ -2371,11 +2371,11 @@ def vaspBoxParser(filename):
for
ind
in
range
(
num_atoms
[
zz
]):
# print(ind, kind, cou)
rel_coords
=
np
.
array
([
float
(
ii
)
for
ii
in
all_lines
[
coor_start
+
cou
].
split
()])
abs_coords
=
cell
.
dot
(
rel_coords
)
abs_coords
=
cell
.
T
.
dot
(
rel_coords
)
atoms
.
append
(
xyzAtom
(
kind
,
abs_coords
,
cou
))
cou
+=
1
box
=
xyzBox
(
atoms
,
boxLength
=
0.0
)
box
.
lattice
=
np
.
array
([
cell1
,
cell2
,
cell3
])
box
.
lattice
=
np
.
array
([
cell1
,
cell2
,
cell3
])
.
T
box
.
lattice_inv
=
np
.
linalg
.
inv
(
box
.
lattice
)
return
box
...
...
@@ -2409,7 +2409,7 @@ def vaspTrajecParser(filename, min_boxes=0, max_boxes=1000):
atoms
.
append
(
xyzAtom
(
([
atom_kinds
[
ii_kind
]]
*
num_atoms
[
ii_kind
])[
jj_num
]
,
coordinates
[
coorcou
],
counter
))
coorcou
+=
1
box
=
xyzBox
(
atoms
,
boxLength
=
0.0
)
box
.
lattice
=
np
.
array
([
cell1
,
cell2
,
cell3
])
box
.
lattice
=
np
.
array
([
cell1
,
cell2
,
cell3
])
.
T
box
.
lattice_inv
=
np
.
linalg
.
inv
(
box
.
lattice
)
boxes
.
append
(
box
)
# if first box, start here
...
...
@@ -2440,7 +2440,7 @@ def vaspTrajecParser(filename, min_boxes=0, max_boxes=1000):
#print(counter, line.split())
cell
=
np
.
array
([
cell1
,
cell2
,
cell3
])
rel_coords
=
np
.
array
([
float
(
ii
)
for
ii
in
line
.
split
()])
abs_coords
=
cell
.
dot
(
rel_coords
)
abs_coords
=
cell
.
T
.
dot
(
rel_coords
)
coordinates
.
append
(
abs_coords
)
counter
+=
1
return
boxes
...
...
@@ -3181,7 +3181,7 @@ def parseVaspFile(fname):
for
jj
in
range
(
ntypat
[
ii
]):
atomType
.
append
(
elements
[
ii
])
# get absolute atom positions
xabs
=
[
np
.
dot
(
lattice
,
xred
[
ii
])
for
ii
in
range
(
len
(
xred
))]
xabs
=
[
np
.
dot
(
lattice
.
T
,
xred
[
ii
])
for
ii
in
range
(
len
(
xred
))]
# create the box
xyzAtoms
=
[]
for
ii
in
range
(
len
(
xabs
)):
...
...
@@ -3295,7 +3295,7 @@ def parseOCEANinputFile(fname):
for
at
in
typat
:
atoms
.
append
(
atoms_name
[
at
-
1
])
xabs
=
[
np
.
dot
(
lattice
,
xred
[
ii
])
for
ii
in
range
(
len
(
xred
))]
xabs
=
[
np
.
dot
(
lattice
.
T
,
xred
[
ii
])
for
ii
in
range
(
len
(
xred
))]
xyzAtoms
=
[]
for
ii
in
range
(
len
(
xabs
)):
...
...
@@ -3303,8 +3303,8 @@ def parseOCEANinputFile(fname):
box
=
xyzBox
(
xyzAtoms
)
box
.
lattice
=
lattice
box
.
lattice_inv
=
np
.
linalg
.
inv
(
lattice
)
box
.
lattice
=
lattice
.
T
box
.
lattice_inv
=
np
.
linalg
.
inv
(
lattice
.
T
)
box
.
relAtoms
=
xred
return
box
...
...
XRStools/xrs_extraction.py
View file @
adab0a7f
...
...
@@ -381,6 +381,8 @@ class edge_extraction:
def
removeCorePearsonAv
(
self
,
element
,
edge
,
range1
,
range2
,
weights
=
[
2
,
1
],
HFcore_shift
=
0.0
,
guess
=
None
,
scaling
=
None
,
return_background
=
False
):
"""
**removeCorePearsonAv**
guess (list): [position, FWHM, shape, intensity, ax, b, scale ]
"""
# check that there are averaged signals available
if
not
np
.
any
(
self
.
avsignals
):
...
...
XRStools/xrs_utilities.py
View file @
adab0a7f
...
...
@@ -359,6 +359,9 @@ def get_gnuplot_rgb( start=None, end=None, length=None ):
for
ii
in
range
(
len
(
rgb
)):
print
(
'set style line %d lt -1 lc rgb
\'
#%02x%02x%02x
\'
lw 1.5'
%
(
ii
+
1
,
rgb
[
ii
][
0
]
*
255.
,
rgb
[
ii
][
1
]
*
255.
,
rgb
[
ii
][
2
]
*
255.
)
)
def
hex2rgb
(
hex_val
):
return
tuple
(
int
(
hex_val
.
lstrip
(
'#'
)[
i
:
i
+
2
],
16
)
for
i
in
(
0
,
2
,
4
)
)
class
maxipix_det
:
"""
Class to store some useful values from the detectors used. To be used for arranging the ROIs.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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