Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sdc
kis_tools
Commits
c11400de
Commit
c11400de
authored
Apr 07, 2020
by
Carl Schaffer
Browse files
Merge branch 'penubral_thumbs' into 'master'
Penubral thumbs See merge request
!107
parents
5f0c3dfa
9c47faaf
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
kis_tools/__init__.py
View file @
c11400de
__version__
=
'2.1.
0
'
__version__
=
'2.1.
1
'
from
.generic
import
get_file_wrapper
\ No newline at end of file
kis_tools/gris/plotting.py
View file @
c11400de
import
re
from
glob
import
glob
from
os.path
import
basename
import
matplotlib.pyplot
as
plt
import
numpy
as
np
from
astropy.io.fits
import
open
as
fitsopen
from
matplotlib.font_manager
import
FontProperties
from
matplotlib.widgets
import
Slider
,
RadioButtons
from
scipy.io.idl
import
readsav
from
.GrisFitsFile
import
GrisFitsFile
...
...
@@ -26,12 +29,14 @@ def plot_pen_mask(filename):
intensity
=
intensity
[:,
:
mask
.
shape
[
1
]]
aspect_ratio
=
mask
.
shape
[
0
]
/
mask
.
shape
[
1
]
shape_inches
=
(
max
([
8
/
aspect_ratio
+
.
5
,
3
]),
8
)
shape_inches
=
(
max
([
8
/
aspect_ratio
+
.
5
,
3
])
+
.
5
,
8
)
dpi
=
100
step_width
=
0.135
n_pixels_x
,
n_pixels_y
=
mask
.
shape
extent
=
[
0
,
n_pixels_y
*
step_width
,
0
,
n_pixels_x
*
step_width
]
color_map
=
'jet'
color_map
=
plt
.
get_cmap
(
"jet"
)
print
(
shape_inches
)
fig
=
plt
.
figure
(
figsize
=
shape_inches
,
dpi
=
dpi
)
ax
=
fig
.
subplots
(
1
)
...
...
@@ -48,13 +53,38 @@ def plot_pen_mask(filename):
kwargs
=
dict
(
extent
=
extent
,
levels
=
[
-
1.5
,
-
.
5
,
.
5
,
1.5
,
2.5
],
origin
=
'upper'
,
cmap
=
color_map
)
ax
.
contourf
(
mask
,
**
kwargs
,
alpha
=
.
4
)
ax
.
contour
(
mask
,
**
kwargs
)
ax
.
set_title
(
"artifacts, quiet sun,
\n
penumbra and umbra"
)
fig
.
tight_layout
()
contf
=
ax
.
contourf
(
mask
,
**
kwargs
,
alpha
=
.
4
)
cont
=
ax
.
contour
(
mask
,
**
kwargs
)
# Create legend
labels
=
[
"Invalid"
,
"Quiet Sun"
,
"Penumbra"
,
"Umbra"
,
]
# legend proxy objects
proxy
=
[]
for
c
in
contf
.
collections
:
rect
=
plt
.
Rectangle
((
0
,
0
),
1
,
1
,
fc
=
c
.
get_facecolor
()[
0
])
proxy
.
append
(
rect
)
fontP
=
FontProperties
()
fontP
.
set_size
(
'small'
)
chartBox
=
ax
.
get_position
()
ax
.
set_position
([
chartBox
.
x0
,
chartBox
.
y0
,
chartBox
.
width
*
0.6
,
chartBox
.
height
])
# ax.legend(proxy,labels,prop=fontP,loc='upper left', bbox_to_anchor=(1.45, 0.8), shadow=True, ncol=1)
fig
.
legend
(
proxy
,
labels
,
prop
=
fontP
,
loc
=
'lower right'
,
framealpha
=
1
)
ax
.
set_title
(
"."
.
join
(
basename
(
filename
).
split
(
"."
)[:
-
1
]))
fig
.
tight_layout
(
pad
=
3
)
plt
.
show
()
return
fig
,
ax
...
...
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