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
Vasudevan, Rama K
pycroscopy
Commits
e0ccd48e
Commit
e0ccd48e
authored
Sep 20, 2016
by
Chris Smith
Browse files
Fixed circular import and removed useless GetGoodLims function
parent
a21c7421
Changes
2
Hide whitespace changes
Inline
Side-by-side
pycroscopy/analysis/be_sho_utils.py
View file @
e0ccd48e
...
...
@@ -70,24 +70,24 @@ def plotLoops(dc_vec, resp_mat, x_label='', y_label='', title=None, save_path=No
fig
.
savefig
(
save_path
,
format
=
'png'
,
dpi
=
300
)
def
getGoodLims
(
resp_mat
):
'''
Returns the mean and standard deviation of the provided numpy array
Parameters
------------
resp_mat : numpy ndarray
N dimensional array containing homogenous data
Returns
---------
mean: float
Mean of the complete dataset
std: float
Standard deviation of the dataset
'''
return
np
.
mean
(
resp_mat
),
np
.
std
(
resp_mat
)
#
def getGoodLims(resp_mat):
#
'''
#
Returns the mean and standard deviation of the provided numpy array
#
#
Parameters
#
------------
#
resp_mat : numpy ndarray
#
N dimensional array containing homogenous data
#
#
Returns
#
---------
#
mean: float
#
Mean of the complete dataset
#
std: float
#
Standard deviation of the dataset
#
'''
#
return np.mean(resp_mat), np.std(resp_mat)
#
#%%
...
...
pycroscopy/viz/plot_utils.py
View file @
e0ccd48e
...
...
@@ -12,7 +12,6 @@ from scipy.cluster.hierarchy import linkage, dendrogram
from
scipy.spatial.distance
import
pdist
from
warnings
import
warn
from
mpl_toolkits.axes_grid1
import
make_axes_locatable
from
..analysis.be_sho_utils
import
getGoodLims
###############################################################################
...
...
@@ -153,7 +152,8 @@ def plotSHOMaps(sho_maps, map_names, stdevs=2, title='', save_path=None):
fig
,
axes
=
plt
.
subplots
(
ncols
=
3
,
nrows
=
2
,
sharex
=
True
,
figsize
=
(
15
,
10
))
for
index
,
ax_hand
,
data_mat
,
qty_name
in
zip
(
range
(
len
(
map_names
)),
axes
.
flat
,
sho_maps
,
map_names
):
(
amp_mean
,
amp_std
)
=
getGoodLims
(
data_mat
)
amp_mean
=
np
.
mean
(
data_mat
)
amp_std
=
np
.
std
(
data_mat
)
pcol0
=
ax_hand
.
pcolor
(
data_mat
,
vmin
=
amp_mean
-
stdevs
*
amp_std
,
vmax
=
amp_mean
+
stdevs
*
amp_std
)
...
...
@@ -208,7 +208,8 @@ def plotVSsnapshots(resp_mat, title='', stdevs=2, save_path=None):
for
count
,
posn
in
enumerate
(
xrange
(
0
,
num_udvs
,
delta_pos
)):
snapshot
=
np
.
squeeze
(
resp_mat
[:,:,
posn
])
(
amp_mean
,
amp_std
)
=
getGoodLims
(
snapshot
)
amp_mean
=
np
.
mean
(
snapshot
)
amp_std
=
np
.
std
(
snapshot
)
ndims
=
len
(
snapshot
.
shape
)
if
ndims
==
2
:
axes_lin
[
count
].
imshow
(
snapshot
,
vmin
=
amp_mean
-
stdevs
*
amp_std
,
vmax
=
amp_mean
+
stdevs
*
amp_std
)
...
...
@@ -262,7 +263,8 @@ def plotSpectrograms(eigenvectors, num_comps=4, title='Eigenvectors', xlabel='St
for
index
in
xrange
(
num_comps
):
cur_map
=
np
.
transpose
(
eigenvectors
[
index
,
:,
:])
ax
=
axes201
.
flat
[
index
]
(
mean
,
std
)
=
getGoodLims
(
cur_map
)
mean
=
np
.
mean
(
cur_map
)
std
=
np
.
std
(
cur_map
)
ax
.
imshow
(
cur_map
,
cmap
=
'jet'
,
vmin
=
mean
-
stdevs
*
std
,
vmax
=
mean
+
stdevs
*
std
)
...
...
@@ -311,7 +313,8 @@ def plotBEspectrograms(eigenvectors, num_comps=4, title='Eigenvectors', xlabel='
funcs
=
[
np
.
abs
,
np
.
angle
]
labels
=
[
'Amplitude'
,
'Phase'
]
for
func
,
lab
,
ax
in
zip
(
funcs
,
labels
,
axes
):
(
amp_mean
,
amp_std
)
=
getGoodLims
(
func
(
cur_map
))
amp_mean
=
np
.
mean
(
func
(
cur_map
))
amp_std
=
np
.
std
(
func
(
cur_map
))
ax
.
imshow
(
func
(
cur_map
),
cmap
=
'inferno'
,
vmin
=
amp_mean
-
stdevs
*
amp_std
,
vmax
=
amp_mean
+
stdevs
*
amp_std
)
...
...
@@ -473,7 +476,8 @@ def plotLoadingMaps(loadings, num_comps=4, stdevs=2, colormap='jet', show_colorb
for
index
in
xrange
(
num_comps
):
cur_map
=
loadings
[:,
:,
index
]
(
amp_mean
,
amp_std
)
=
getGoodLims
(
cur_map
)
amp_mean
=
np
.
mean
(
cur_map
)
amp_std
=
np
.
std
(
cur_map
)
if
show_colorbar
:
pcol0
=
axes202
.
flat
[
index
].
pcolor
(
cur_map
,
vmin
=
amp_mean
-
stdevs
*
amp_std
,
vmax
=
amp_mean
+
stdevs
*
amp_std
)
...
...
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