-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlotImage.py
More file actions
65 lines (46 loc) · 1.7 KB
/
PlotImage.py
File metadata and controls
65 lines (46 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import matplotlib.pyplot as plt
import numpy as np
import sunpy.map
import sunpy.visualization.colormaps as cm
from sunpy.io import fits
from skimage.measure import block_reduce
def downsample(im):
return block_reduce(im, block_size = 2, func = np.nanmedian, cval = np.nanmin(im))
#dir = '/home/mark.miesch/data/lasco_monthly/c3/2012_04/'
#file = dir+'03/32295364.fts'
#file = dir+'02/daily_median.fts'
#dir = '/home/mark.miesch/data/anny/CME0/pos-30/dcmer_030W_bang_0000_fits/tB/'
#file = dir+'frame_0050.fits'
#file = dir+'frame_0000.fits'
# L1 STEREO data
dir='/home/mark.miesch/sunpy/data/secchi_cor2/L1/2012/09/07/'
#file = dir+'20120901_153900_14c2A.fts'
#file = dir+'20120907_163900_14c2A.fts'
file = dir+'daily_median.fts'
scale=(0,2.e-8)
dir='/home/mark.miesch/sunpy/data/secchi_cor2/L1/2012/09/'
file = dir+'background.fts'
scale=(0,2.e-8)
#dir = '/home/mark.miesch/data/lasco_monthly/c3/2012_04/'
#dir = '/home/mark.miesch/data/lasco_monthly/c3/2014_01/'
#file = dir+'background.fts'
#cmap_lasco_c2 = plt.get_cmap('soholasco2')
cmap_stereo_cor2 = plt.get_cmap('stereocor2')
data, header = fits.read(file)[0]
# needed only for the model field
#header['CUNIT1'] = 'arcsec'
#header['CUNIT2'] = 'arcsec'
#header['CDELT1'] = 30/float(nx)
#header['CDELT2'] = 30/float(ny)
#
#header['CRPIX1'] = 242.5
#header['CRPIX2'] = 242.5
#print(f"{header['CRPIX1']} {header['CRPIX2']}")
dmap = sunpy.map.Map(data, header)
#dmap.plot(cmap = cmap_stereo_cor2)
#plt.imshow(data, cmap = cmap_stereo_cor2,vmin=scale[0],vmax=scale[1])
d = downsample(data)
plt.figimage(d,cmap=cmap_stereo_cor2,vmin=scale[0],vmax=scale[1],resize=True,
origin='lower')
print(f" minmax: {np.nanmin(data)} {np.nanmax(data)}")
plt.show()