def read_file(date): # Use date to find filename mgnt = CRD(filename) mgnt.heliographic(mgnt.im_raw.data) mgnt.magnetic_flux(mgnt.im_raw.data) mgnt.magnetic_flux(mgnt.im_raw.data, raw_field=True)
def CRD_read(date, instr): try: filename = search_file(date, instr) except IOError: return -1 print(filename) try: mgnt = CRD(filename) except: return -1 mgnt.heliographic() mgnt.magnetic_flux() mgnt.magnetic_flux(raw_field=True) mgnt.date = mgnt.im_raw.date mgnt.md = date2md(date, instr) return mgnt
from zaw_coord import CRD import kpvt_class #import sunpy.wcs import numpy as np import timeit start = timeit.default_timer() #x = CRD('MDI\\fd_M_96m_01d.1222.0005.fits') #kpvt = CRD('512c_eo000_C1_19771001_2048.fits') #spmg = CRD('spmg_eo100_C1_19920421_1700.fits') hmi = CRD('HMI\\hmi.M_720s.20100504_214800_TAI.1.magnetogram.fits') #Heliographic testing # lonh, lath = x.heliographic(x.im_raw.data) # print ( "Array Latitude = %s Longitude = %s " %(lath[52,650], lonh[52,650]) ) # lonh, lath = x.heliographic(52,650) # print ( "Coordinate Latitude = %s Longitude = %s " %(lath, lonh) ) #x.heliographic(x.im_raw.data) # print ( "Array Latitude = %s Longitude = %s " %(lath[511,511], lonh[511,511]) ) # lonh, lath = x.heliographic(511, 511) # print ( "Coordinate Latitude = %s Longitude = %s " %(lath, lonh) ) #print( sunpy.wcs.convert_hpc_hg(0*x.im_raw.scale[0].value, 0*x.im_raw.scale[1].value, b0_deg = x.im_raw.meta['B0'], l0_deg = x.im_raw.meta['L0']) ) #LOS testing # corr = x.los_corr(x.im_raw.data) #print( "Raw field = %s " %x.im_raw.data[750,750]) #print( "Corrected field = %s " %corr[750, 750])
from zaw_coord import CRD import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt x = CRD('MDI\\fd_M_96m_01d.1222.0005.fits') area = x.eoa(x.im_raw.data).value.flatten() area = area[~np.isnan(area)] loc = np.arange(0, 5e17, 5e17 / 999) n, bins, patches = plt.hist(area, loc, log=True) print(n.max()) plt.axis([0, 5e17, 0, 60000]) l = plt.plot(bins, 'r--', linewidth=1) plt.show()
from zaw_coord import CRD import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt x = CRD('MDI\\fd_M_96m_01d.1222.0005.fits') area = x.eoa(x.im_raw.data).value.flatten() area = area[~np.isnan(area)] loc = np.arange(0, 5e17, 5e17/999) n, bins, patches = plt.hist(area, loc, log=True) print(n.max()) plt.axis([0,5e17, 0, 60000]) l = plt.plot(bins, 'r--', linewidth=1) plt.show()
from zaw_coord import CRD import kpvt_class #import sunpy.wcs import numpy as np import timeit start = timeit.default_timer() #x = CRD('MDI\\fd_M_96m_01d.1222.0005.fits') #kpvt = CRD('512c_eo000_C1_19771001_2048.fits') #spmg = CRD('spmg_eo100_C1_19920421_1700.fits') hmi = CRD('HMI\\hmi.M_720s.20100504_214800_TAI.1.magnetogram.fits') #Heliographic testing # lonh, lath = x.heliographic(x.im_raw.data) # print ( "Array Latitude = %s Longitude = %s " %(lath[52,650], lonh[52,650]) ) # lonh, lath = x.heliographic(52,650) # print ( "Coordinate Latitude = %s Longitude = %s " %(lath, lonh) ) #x.heliographic(x.im_raw.data) # print ( "Array Latitude = %s Longitude = %s " %(lath[511,511], lonh[511,511]) ) # lonh, lath = x.heliographic(511, 511) # print ( "Coordinate Latitude = %s Longitude = %s " %(lath, lonh) ) #print( sunpy.wcs.convert_hpc_hg(0*x.im_raw.scale[0].value, 0*x.im_raw.scale[1].value, b0_deg = x.im_raw.meta['B0'], l0_deg = x.im_raw.meta['L0']) ) #LOS testing # corr = x.los_corr(x.im_raw.data)