Beispiel #1
0
def map_unravel(maps, params, verbose=False):
    """ Unravel the maps into a rectangular image. """
    new_maps = []
    for index, m in enumerate(maps):
        if verbose:
            print("Unraveling map %(#)i of %(n)i " % {'#':index+1, 'n':len(maps)})
        unraveled = util.map_hpc_to_hg_rotate(m,
                                               epi_lon=params.get('epi_lon'),
                                               epi_lat=params.get('epi_lat'),
                                               lon_bin=5,
                                               lat_bin=0.2)
        unraveled[np.isnan(unraveled)] = 0.0
        new_maps += [unraveled]
    return new_maps
Beispiel #2
0
def map_unravel(maps, params, verbose=False):
    """ Unravel the maps into a rectangular image. """
    new_maps = []
    for index, m in enumerate(maps):
        if verbose:
            print("Unraveling map %(#)i of %(n)i " % {'#':index+1, 'n':len(maps)})
        unraveled = util.map_hpc_to_hg_rotate(m,
                                               epi_lon=params.get('epi_lon'),
                                               epi_lat=params.get('epi_lat'),
                                               lon_bin=params.get('lon_bin'),
                                               lat_bin=params.get('lat_bin'))
            #print type(unraveled)
            #test=np.isnan(unraveled)
            #print len(test)
            #print test[0:10]
            #print unraveled.data[0:10]
        unraveled.data[np.isnan(unraveled)] = 0.0
        new_maps += [unraveled]
    return new_maps
Beispiel #3
0
# Unraveling params are different compared to the wave definition params
params_unravel = copy.deepcopy(params)

# Sum over many of the original bins used to create the wave in an attempt to
# beat down transform artifacts
params_unravel['lon_bin'] = unraveling_factor * params['lon_bin']
params_unravel['lat_bin'] = unraveling_factor * params['lat_bin']

# Move zero location of longitudinal reconstruction relative to the
# wavefront
# params_unravel['lon_min'] = params_unravel['lon_min']
# params_unravel['lon_max'] = params_unravel['lon_max']

# Storage for the results
results = []

# Go through all the test waves, and apply AWARE.
# Let the user which trial is happening
print('\nSimulating %s ' % example)
print(' - position choice = %s' % position_choice)
print(' - error choice = %s' % error_choice)
print(' - unraveling factor = %f' % unraveling_factor)

# Simulate the wave and return a dictionary
out = test_wave2d.simulate_wave2d(params=params, max_steps=max_steps,
                                  verbose=True, output=['raw', 'transformed', 'noise', 'finalmaps'])

t0 = out['transformed'][0]
b0 = util.map_hpc_to_hg_rotate(t0, epi_lon=0, epi_lat=0.0, lon_bin=1.0, lat_bin=1.0)
Beispiel #4
0
    return img

m2deg = 360./(2*3.1415926*6.96e8)

cube = sunpy.make_map("/home/hayesla/fits/data/", type = "cube")
dmap = cube[2] - cube[1]
dmap.show()

# need an even number of maps so get rid of one
cube = cube[0:4]

import util

tmap = util.map_hpc_to_hg(dmap)

ttmap = util.map_hpc_to_hg_rotate(dmap, epi_lon = 9.5, epi_lat = 20.44)
input_maps = []

for map in cube:
    print("Unraveling map at "+str(map.date))
    input_maps += [util.map_hpc_to_hg_rotate(map, epi_lon = 9.5, epi_lat = 20.44)]

#wave_maps = wave2d.simulate(params, verbose = True)
#visualize(wave_maps)
#
# Use Albert's wavemaps to test the hough transform as a means
# of detecting EIT waves

#
# Initial detection is based on Hough transform of absolute
# value of the running difference.
Beispiel #5
0
for i in range(len(wave_maps)):
    wave_maps[i] = sunpy.map.Map.superpixel(wave_maps[i], (4,4), method = 'sum')

    #To get simulated HG' maps (centered at wave epicenter):
wave_mapsp_raw = wave2d.simulate_raw(waveparams)
wave_mapsp_raw_noise = wave2d.add_noise(waveparams, wave_mapsp_raw)
   
#visualize(wave_maps)
   
import util
   
new_wave_maps = []
   
for wave in wave_maps:
    print("Unraveling map at "+str(wave.date))
    new_wave_maps += [util.map_hpc_to_hg_rotate(wave, epi_lon = waveparams.get('epi_lon'), epi_lat = waveparams.get('epi_lat'), lon_bin = 5, lat_bin = 0.2)]


input_maps = new_wave_maps

#wave_maps = wave2d.simulate(params, verbose = True)
#visualize(wave_maps)
#
# Use Albert's wavemaps to test the hough transform as a means
# of detecting EIT waves

#
# Initial detection is based on Hough transform of absolute
# value of the running difference.
#
# Possible algorithm outline
Beispiel #6
0
wave_maps = wave2d.simulate(params, verbose=True)

#To get simulated HG' maps (centered at wave epicenter):
wave_maps_raw = wave2d.simulate_raw(params)
#wave_maps_raw_noise = wave2d.add_noise(params, wave_maps_raw)

visualize(wave_maps)

new_wave_maps = []

for wave in wave_maps:
    print("Unraveling map at " + str(wave.date))
    new_wave_maps += [
        util.map_hpc_to_hg_rotate(wave,
                                  epi_lon=params["epi_lon"],
                                  epi_lat=params["epi_lat"],
                                  xbin=1,
                                  ybin=0.05)
    ]

lat_min = params["lat_min"]
cadence = params["cadence"]
width_coeff = wave2d.wave2d.prep_coeff(params["width"])
wave_thickness_coeff = wave2d.wave2d.prep_coeff(params["wave_thickness"])
wave_normalization_coeff = wave2d.wave2d.prep_coeff(
    params["wave_normalization"])
speed_coeff = wave2d.wave2d.prep_coeff(params["speed"])
p = np.poly1d([
    speed_coeff[2] / 3., speed_coeff[1] / 2., speed_coeff[0], -(90. - lat_min)
])
time = np.arange(len(wave_maps)) * cadence
Beispiel #7
0
m2deg = 360. / (2 * 3.1415926 * 6.96e8)

cube = sunpy.make_map("/Users/schriste/Downloads/eitdata_19970512/*.fits",
                      type="cube")
dmap = cube[2] - cube[1]
dmap.show()

# need an even number of maps so get rid of one
cube = cube[0:4]

import util

tmap = util.map_hpc_to_hg(dmap)

ttmap = util.map_hpc_to_hg_rotate(dmap, epi_lon=9.5, epi_lat=20.44)
input_maps = []

for map in cube:
    print("Unraveling map at " + str(map.date))
    input_maps += [util.map_hpc_to_hg_rotate(map, epi_lon=9.5, epi_lat=20.44)]

#wave_maps = wave2d.simulate(params, verbose = True)
#visualize(wave_maps)
#
# Use Albert's wavemaps to test the hough transform as a means
# of detecting EIT waves

#
# Initial detection is based on Hough transform of absolute
# value of the running difference.
Beispiel #8
0
import sunpy
from sunpy.wcs import wcs
import util

aia = sunpy.Map(sunpy.AIA_171_IMAGE).resample([500,500])

tmap = util.map_hpc_to_hg(aia)
tmap.show()

tmap_rot = util.map_hpc_to_hg_rotate(aia, epi_lon = 0, epi_lat = 0)
tmap_rot.show()
# BUG at the edges where the Sun wraps around, HPC to HG gives the same longitude
# for points behind and in front of the limb.

# no rotation, or put the NP at the NP
rotmap = util.map_hpc_to_hg_rotate(aia, epi_lon = 0, epi_lat = 90)

# the following command puts a feature at -6, -32 to the NP
rotmap = util.map_hpc_to_hg_rotate(aia, epi_lon = -6, epi_lat = -32)

ttmap = util.map_hg_to_hpc(tmap)
ttmap.show()

# WARNING!
# if the following line is run after the previousl line than it gives an error
# but not otherwise...not sure why...
ttmap = util.map_hg_to_hpc(tmap, xbin = 5, ybin = 5)
Beispiel #9
0
wave_maps = wave2d.simulate(params, verbose = True)
    
    #To get simulated HG' maps (centered at wave epicenter):
wave_maps_raw = wave2d.simulate_raw(params)
wave_maps_raw_noise = wave2d.add_noise(params, wave_maps_raw)
    
visualize(wave_maps)
    
import util
    
new_wave_maps = []
    
for wave in wave_maps:
    print("Unraveling map at "+str(wave.date))
    new_wave_maps += [util.map_hpc_to_hg_rotate(wave, epi_lon = params.get('epi_lon'), epi_lat = params.get('epi_lat'), xbin = 5, ybin = 0.2)]

input_maps = new_wave_maps

#wave_maps = wave2d.simulate(params, verbose = True)
#visualize(wave_maps)
#
# Use Albert's wavemaps to test the hough transform as a means
# of detecting EIT waves

#
# Initial detection is based on Hough transform of absolute
# value of the running difference.
#
# Possible algorithm outline
#
#To get simulated HG' maps (centered at wave epicenter):
wave_maps_raw = wave2d.simulate_raw(params)
wave_maps_raw_noise = wave2d.add_noise(params, wave_maps_raw)

visualize(wave_maps)

import util

new_wave_maps = []

for wave in wave_maps:
    print("Unraveling map at " + str(wave.date))
    new_wave_maps += [
        util.map_hpc_to_hg_rotate(wave,
                                  epi_lon=params.get('epi_lon'),
                                  epi_lat=params.get('epi_lat'),
                                  xbin=5,
                                  ybin=0.2)
    ]

input_maps = new_wave_maps

#wave_maps = wave2d.simulate(params, verbose = True)
#visualize(wave_maps)
#
# Use Albert's wavemaps to test the hough transform as a means
# of detecting EIT waves

#
# Initial detection is based on Hough transform of absolute
# value of the running difference.
Beispiel #11
0
#wave_maps = wave2d.simulate(params)
wave_maps = wave2d.simulate(params, verbose = True)

#To get simulated HG' maps (centered at wave epicenter):
wave_maps_raw = wave2d.simulate_raw(params)
#wave_maps_raw_noise = wave2d.add_noise(params, wave_maps_raw)

visualize(wave_maps)


new_wave_maps = []

for wave in wave_maps:
    print("Unraveling map at "+str(wave.date))
    new_wave_maps += [util.map_hpc_to_hg_rotate(wave,
                                                epi_lon = params["epi_lon"],
                                                epi_lat = params["epi_lat"],
                                                xbin = 1, ybin = 0.05)]

lat_min = params["lat_min"]
cadence = params["cadence"]
width_coeff = wave2d.wave2d.prep_coeff(params["width"])
wave_thickness_coeff = wave2d.wave2d.prep_coeff(params["wave_thickness"])
wave_normalization_coeff = wave2d.wave2d.prep_coeff(params["wave_normalization"])
speed_coeff = wave2d.wave2d.prep_coeff(params["speed"])
p = np.poly1d([speed_coeff[2]/3., speed_coeff[1]/2., speed_coeff[0],
               -(90.-lat_min)])
time = np.arange(len(wave_maps))*cadence
time_powers = np.vstack((time**0, time**1, time**2))

width = np.dot(width_coeff, time_powers).ravel()
wave_thickness = np.dot(wave_thickness_coeff, time_powers).ravel()