# Use potential extrapolator to generate field
aPotExt = PotentialExtrapolator(map_boundary, zshape=arr_grid_shape[2], zrange=zrange)
aMap3D  = aPotExt.extrapolate(enable_numba=True)

# The Extrapolations run time is stored in the meta
floSeconds = np.round(aMap3D.meta['extrapolator_duration'],3)
print('\nextrapolation duration: ' + str(floSeconds) + ' s\n')

##############################################################################
# Note that you used enable_numba=True to speed up the computation on systems
# with Anaconda numba installed.

##############################################################################
# You can now get a quick and easy visualisation using the
# solarbextrapolation.example_data_generator.visualise tools:

# Visualise the 3D vector field
fig = visualise(aMap3D,
                boundary=map_boundary,
                volume_units=[1.0*u.arcsec, 1.0*u.arcsec, 1.0*u.Mm],
                show_boundary_axes=False,
                boundary_units=[1.0*u.arcsec, 1.0*u.arcsec],
                show_volume_axes=True,
                debug=False)
mlab.show()
##############################################################################
# Note that the parameters here are simply to decide what boundary ranges
# to display.

        self.meta['extrapolator_routine'] = 'Ones Extrapolator'

        #arr_4d = np.ones([self.map_boundary_data.data.shape[0], self.map_boundary_data.data.shape[0], self.z, 3])
        arr_4d = np.ones(self.shape.tolist() + [3])
        return Map3D(arr_4d, self.meta)

###########################################################################
# Instansiate the preprocessor and extrapolate.
aExt = ExtOnes(aPreProMap, zshape=10)
aMap3D = aExt.extrapolate()

###########################################################################
# You can visulise the field using MayaVi.
fig = visualise(aMap3D,
                boundary=aPreProMap,
                show_boundary_axes=False,
                show_volume_axes=False,
                debug=False)
mlab.show()

"""

# aPreProData = aMap2D.submap([0,10], [0,10])

# Some checks:
#aPreProData.data # Should be a 2D zeros array.
#aPreProData.meta
#aPreProData.meta['preprocessor_routine']
#aPreProData.meta['preprocessor_start_time']

###########################################################################
Exemplo n.º 3
0
# Use potential extrapolator to generate field
aPotExt = PotentialExtrapolator(map_boundary,
                                zshape=arr_grid_shape[2],
                                zrange=zrange)
aMap3D = aPotExt.extrapolate(enable_numba=True)

# The Extrapolations run time is stored in the meta
floSeconds = np.round(aMap3D.meta['extrapolator_duration'], 3)
print('\nextrapolation duration: ' + str(floSeconds) + ' s\n')

##############################################################################
# Note that you used enable_numba=True to speed up the computation on systems
# with Anaconda numba installed.

##############################################################################
# You can now get a quick and easy visualisation using the
# solarbextrapolation.example_data_generator.visualise tools:

# Visualise the 3D vector field
fig = visualise(aMap3D,
                boundary=map_boundary,
                volume_units=[1.0 * u.arcsec, 1.0 * u.arcsec, 1.0 * u.Mm],
                show_boundary_axes=False,
                boundary_units=[1.0 * u.arcsec, 1.0 * u.arcsec],
                show_volume_axes=True,
                debug=False)
mlab.show()
##############################################################################
# Note that the parameters here are simply to decide what boundary ranges
# to display.
        #arr_4d = np.ones([self.map_boundary_data.data.shape[0], self.map_boundary_data.data.shape[0], self.z, 3])
        arr_4d = np.ones(self.shape.tolist() + [3])
        return Map3D(arr_4d, self.meta)


###########################################################################
# Instansiate the preprocessor and extrapolate.
aExt = ExtOnes(aPreProMap, zshape=10)
aMap3D = aExt.extrapolate()

###########################################################################
# You can visulise the field using MayaVi.
fig = visualise(aMap3D,
                boundary=aPreProMap,
                show_boundary_axes=False,
                show_volume_axes=False,
                debug=False)
mlab.show()
"""

# aPreProData = aMap2D.submap([0,10], [0,10])

# Some checks:
#aPreProData.data # Should be a 2D zeros array.
#aPreProData.meta
#aPreProData.meta['preprocessor_routine']
#aPreProData.meta['preprocessor_start_time']

###########################################################################
# Testing an extrapolator
map_hmi_cropped_resampled = map_hmi_cropped.resample(dimensions,
                                                     method='linear')

# Open the map and create a cropped version for the visualisation.
#map_boundary = mp.Map('C:\\git\\solarbextrapolation\\examples\\2011-02-14__20-35-25__02_aia.fits') # For AIA
map_boundary = mp.Map(
    'C:\\git\\solarbextrapolation\\examples\\2011-02-14__20-35-25__01_hmi.fits'
)  # For HMI

map_boundary_cropped = map_boundary.submap(xrangeextended, yrangeextended)

# Only extrapolate if we don't have a saved version
if not os.path.isfile(str_vol_filepath):
    aPotExt = PotentialExtrapolator(map_hmi_cropped_resampled,
                                    filepath=str_vol_filepath,
                                    zshape=dimensions[0].value,
                                    zrange=zrange)
    aMap3D = aPotExt.extrapolate()
aMap3D = Map3D.load(str_vol_filepath)
print('\nextrapolation duration: ' + str(np.round(aMap3D.meta['extrapolator_duration'], 3)) + ' s\n')

# Visualise this
visualise(aMap3D,
          boundary=map_boundary_cropped,
          scale=1.0 * u.Mm,
          boundary_unit=1.0 * u.arcsec,
          show_boundary_axes=False,
          show_volume_axes=True,
          debug=False)
mlab.show()
Exemplo n.º 6
0
aMap3D = Map3D.load(str_vol_filepath)
#print '\nextrapolation duration: ' + str(np.round(aMap3D.meta['extrapolator_duration'],3)) + ' s\n'

################################################################################
# For the perposes of visualisation we will want an extended boundary data, not
# just that of the extrapolated region, and at the instruments full resolution,
# not resampled.

xrangeextended = u.Quantity([xrange.value[0] - 50, xrange.value[1] + 50] *
                            xrange.unit)
yrangeextended = u.Quantity([yrange.value[0] - 50, yrange.value[1] + 50] *
                            yrange.unit)

# Open the map and create a cropped version for the visualisation.
map_boundary = mp.Map(data_hmi[0])
map_boundary_cropped = map_boundary.submap(xrangeextended, yrangeextended)

################################################################################
# You can now get a quick and easy visualisation using the
# solarbextrapolation.example_data_generator.visualise tools:

# Visualise the 3D vector field
visualise(aMap3D,
          boundary=map_boundary_cropped,
          scale=1.0 * u.Mm,
          boundary_unit=1.0 * u.arcsec,
          show_boundary_axes=False,
          show_volume_axes=True,
          debug=False)
mlab.show()