Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 4 additions & 50 deletions examples/create_box.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python3

import astropy.time
import sunpy.sun.constants
from astropy.coordinates import SkyCoord
Expand All @@ -10,57 +8,13 @@
app = QApplication([])
from pyampp.gxbox.gxbox_factory import GxBox

time = astropy.time.Time('2014-11-01T16:40:00')
# box_origin = SkyCoord(lon=30 * u.deg, lat=20 * u.deg,
# radius=sunpy.sun.constants.radius,
# frame='heliographic_carrington')
## dots source
# box_origin = SkyCoord(-475 * u.arcsec, -330 * u.arcsec, obstime=time, observer="earth", frame='helioprojective')
## flare AR
box_origin = SkyCoord(-632 * u.arcsec, -135 * u.arcsec, obstime=time, observer="earth", frame='helioprojective')
# box_origin = SkyCoord(-750 * u.arcsec, -400 * u.arcsec, obstime=time, observer="earth", frame='helioprojective')
time = astropy.time.Time('2020-12-01T20:00:00')
observer = get_earth(time)
box_dimensions = u.Quantity([150, 150, 100]) * u.Mm
box_origin = SkyCoord(450 * u.arcsec, -320 * u.arcsec, obstime=time, observer=observer, rsun=696 * u.Mm, frame='helioprojective')
box_dimensions = u.Quantity([400, 300, 300]) * u.pix
box_res = 1.4 * u.Mm


gxbox = GxBox(time, observer, box_origin, box_dimensions)
gxbox.show()
app.exec_()

# ## process hmi map
# from pyampp.util.config import HMI_B_SEGMENTS
# from sunpy.map import Map
# from pyampp.gxbox.boxutils import hmi_disambig, hmi_b2ptr
# map_azimuth = hmi_disambig(gxbox.sdofitsfiles['hmi_b']['azimuth'], gxbox.sdofitsfiles['hmi_b']['disambig'])
# map_inclination = Map(gxbox.sdofitsfiles['hmi_b']['inclination'])
# map_field = Map(gxbox.sdofitsfiles['hmi_b']['field'])
#
# map_bp, map_bt, map_br = hmi_b2ptr(map_field, map_inclination, map_azimuth)



# box_origin_hs = box_origin.transform_to('heliographic_carrington')
# new_observer = SkyCoord(box_origin_hs.lon, box_origin_hs.lat, box_origin.distance.value*u.AU, obstime=time,
# frame='heliographic_carrington')
#
# out_shape = aia_map.data.shape
#
# out_ref_coord = SkyCoord(0*u.arcsec, 0*u.arcsec, obstime=new_observer.obstime,
# frame='helioprojective', observer=new_observer,
# rsun=aia_map.coordinate_frame.rsun)
# out_header = sunpy.map.make_fitswcs_header(
# out_shape,
# out_ref_coord,
# scale=u.Quantity(aia_map.scale),
# instrument=aia_map.instrument,
# wavelength=aia_map.wavelength
# )
#
# with Helioprojective.assume_spherical_screen(gxbox.map_plt.observer_coordinate):
# outmap_screen_all = gxbox.map_plt.reproject_to(out_header)
#
# fig = plt.figure()
# ax = fig.add_subplot(projection=outmap_screen_all)
# outmap_screen_all.plot(axes=ax)
# plt.show()
app.exec_()
43 changes: 1 addition & 42 deletions pyampp/gxbox/gxbox_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,52 +1139,11 @@ def main():
gxbox.show()

if args.interactive:
# Start an interactive IPython session for more advanced debugging and exploration
# Start an interactive IPython session for more advanced debugging
import pdb
pdb.set_trace()
# # Start the IPython interactive session in a separate thread to avoid blocking the Qt event loop
# import threading
# def interactive_shell(gxbox):
# IPython.embed(user_ns={'gxbox': gxbox})
#
# thread = threading.Thread(target=interactive_shell, args=(gxbox,))
# thread.start()
app.exec_()


if __name__ == '__main__':
main()
# import astropy.time
# import sunpy.sun.constants
# from astropy.coordinates import SkyCoord
# from sunpy.coordinates import Heliocentric, Helioprojective, get_earth
# import astropy.units as u
# from pyampp.gxbox.gxbox_factory import GxBox
#
# # time = astropy.time.Time('2024-05-09T17:12:00')
# # box_origin = SkyCoord(450 * u.arcsec, -256 * u.arcsec, distance,obstime=time, rsun = 696*u.Mm, observer="earth", frame='helioprojective')
# # box_dimensions = u.Quantity([200, 200, 200]) * u.Mm
#
# time = astropy.time.Time('2014-11-01T16:40:00')
# distance = sun.earth_distance(time)
# box_origin = SkyCoord(lon=30 * u.deg, lat=20 * u.deg,
# obstime=time,
# radius=696 * u.Mm,
# frame='heliographic_carrington')
# ## dots source
# # box_origin = SkyCoord(-475 * u.arcsec, -330 * u.arcsec, distance,obstime=time, rsun = 696*u.Mm, observer="earth", frame='helioprojective')
# ## flare AR
# box_origin = SkyCoord(-632 * u.arcsec, -135 * u.arcsec, obstime=time, rsun=696 * u.Mm, observer="earth",
# frame='helioprojective')
# box_dimensions = u.Quantity([150, 150, 100]) * u.Mm
#
# box_res = 0.6 * u.Mm
# box_res = 1.4 * u.Mm
# # box_dimensions = u.Quantity([128, 128, 128]) * u.Mm * 1.4
# box_dimensions = u.Quantity([64, 64, 64]) * u.Mm * 1.4
# observer = get_earth(time)
#
# app = QApplication(sys.argv)
# gxbox = GxBox(time, observer, box_origin, box_dimensions, box_res)
# gxbox.show()
# sys.exit(app.exec_())
Loading