Source code for irfpy.vima.efficiency0

''' Response function for VEX/IMA. Very primitive version.
'''
import numpy as np
import matplotlib.pyplot as plt

from irfpy.mima.efficiency0 import (param_sigma, genfunc_general_gaussian,
                                    MimaElevResp as VimaElevResp,
                                    MimaEnerResp as VimaEnerResp,)

import numpy as np

[docs]class VimaAzimResp: g3data = '''-250 0 -30 0 -26.0961853876 0 -24.9494998916 234.525550286 -23.9724787475 485.841844536 -22.9949905761 847.22090948 -22.0596015812 1287.2273589 -20.9938452472 2450.47008523 -19.9709219898 3519.38441352 -18.9903647817 4604.03311446 -17.9668410606 5814.45671936 -17.0296506747 6678.9909986 -16.0075947537 7543.50303846 -14.986339451 8219.33604283 -14.0083175341 8706.50113143 -12.989063777 8910.63654711 -12.0131101239 8910.38079406 -10.9526245267 8831.48653683 -10.0197041048 8689.73262686 -9.00258532978 8390.72394794 -8.02856650413 7934.49385915 -7.01291552921 7289.57361518 -5.99813189074 6440.25108278 -4.98394871595 5449.41927377 -4.01293220876 4285.64280194 -3.00008339773 2980.3459338 -2.02946719967 1722.22994423 -1.01461684301 888.630664791 0.00163459560439 385.219697433 1.01882008885 101.934271465 1.99437343282 7.33900067274 2.97026036773 0 4.96460044145 0 10.2686963822 0 250 0''' singleton_instance = None def __init__(self): s = VimaAzimResp.g3data val = [(_.split()[0], _.split()[1]) for _ in s.split('\n')] self.dset = np.array(val, dtype=float) from scipy import interpolate self.lin_intp = interpolate.interp1d(self.dset[:, 0], self.dset[:, 1])
[docs] @classmethod def get_instance(cls): if cls.singleton_instance == None: cls.singleton_instance = VimaAzimResp() return cls.singleton_instance
def __call__(self, angle_degrees): self.get_response(angle_degrees)
[docs] def get_response(self, angle_degrees): ang = angle_degrees - 11.25 while ang <= -180: ang += 360 while ang >= 180: ang -= 360 val = self.lin_intp(ang) return val / self.dset[:, 1].max()