Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Started creating FOXSI-2 objects #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
started creating a foxsi2 photon list object.
aringlis committed Jun 15, 2016
commit 18c55cfae0b7a6c170ec30ad8600097746fec604
50 changes: 50 additions & 0 deletions foxsi_objects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import pandas
import sunpy
import sunpy.map
import numpy as np
import matplotlib.pyplot as plt

class Foxsi2PhotonList():

def __init__(self, filename):
self.data = pandas.DataFrame.from_csv(filename)
self.detector = self.data['detector_number'].values[0]
self.number_of_hits = len(self.data)

def get_image(self,time_range = [69100,69600], energy_range = [0,100]):

bins=[np.linspace(-1000,1000,201),np.linspace(-1000,1000,201)]
image_hits = self.data.query('energy2 > ' +str(energy_range[0]) +
' and energy2 < ' + str(energy_range[1]) +
' and wsmr_time > ' + str(time_range[0]) +
' and wsmr_time < ' + str(time_range[1]))

h = plt.hist2d(image_hits['hit_xy_solar_x'],image_hits['hit_xy_solar_y'], bins=bins)
img=h[0].swapaxes(0,1)

dict_header = {
"cdelt1": 10.0,
"naxis1": 201,
"crval1": 0.0,
"crpix1": 100,
"cunit1": "arcsec",
"ctype1": "HPLN-TAN",
"cdelt2": 10.0,
"naxis2": 201,
"crval2": 0.0,
"crpix2": 100,
"cunit2": "arcsec",
"ctype2": "HPLT-TAN",
"observatory":"FOXSI",
"detector":self.detector
}

foxsi_map = sunpy.map.GenericMap(img, dict_header)

return foxsi_map