irfpy.mima.efficiency0

Response function. See also Geometic factor.

irfpy.mima.efficiency0.param_sigma(param_fwhm, param_p)[source]

Return the sigma for general gaussian.

As in Geometic factor, it is derived as

\[\sigma = \frac{\mathrm{FWHM}}{2(2\ln 2)^\frac{1}{2p}}\]
>>> print('%.2f' % param_sigma(22.5, 10))
11.07
irfpy.mima.efficiency0.genfunc_general_gaussian(param_sigma, param_p)[source]

Return the general gaussian function

It is in the form of:

\[f(x) = \exp\Bigl(-\frac{1}{2}\Bigl|\frac{x}{\sigma}\Bigr|^{2p}\Bigr)\]
Parameters
  • param_sigma\(\sigma\).

  • param_p\(p\).

Returns

A function, f(x).

irfpy.mima.efficiency0.resp_phi1(angle_degrees)[source]

Return the response function

This is outdated. (Too unrealistic response for MIMA)

class irfpy.mima.efficiency0.MimaAzimResp[source]

Bases: object

Mex/IMA azimuthal response.

The data is taken from Fig 30 in Barabash et al. 2007.

>>> aresp = MimaAzimResp.get_instance()
>>> print('%.4f' % aresp(0))
0.9985
g3data = '\n-180 0\n-17.9893238434  0\n-16.0676156584  0\n-15  0.0632480957563\n-13.9857651246  0.133405488714\n-13.024911032  0.223150840888\n-12.0106761566  0.3259524123\n-10.9964412811  0.423857356945\n-9.98220640569  0.525026719434\n-8.96797153025  0.611506201619\n-8.00711743772  0.707780389484\n-6.99288256228  0.792627662747\n-5.97864768683  0.86604947355\n-5.01779359431  0.928047274037\n-4.05693950178  0.975355194219\n-2.98932384342  1.0144991655\n-1.97508896797  1.04711575324\n-1.01423487544  1.06667612173\n0  1.07970620239\n1.06761565836  1.08130936845\n2.02846975089  1.07148997634\n2.98932384342  1.04045186823\n4.00355871886  0.963710458141\n5.07117437722  0.820047030077\n5.97864768683  0.6159962283\n6.99288256228  0.418471357928\n8.00711743772  0.224210905402\n9.02135231317  0.093606600862\n10.0355871886  0.0446127424595\n12.0106761566  0\n180 0\n'
singleton_instance = None
classmethod get_instance()[source]
get_response(angle_degrees)[source]
class irfpy.mima.efficiency0.MimaElevRespTrapezoid(pacc)[source]

Bases: object

MEX/IMA elevation response approximated by trapezoid

The original function comes from MimaElevResp, No dependence on PACC.

>>> lresp = MimaElevRespTrapezoid.get_instance(-2000)
>>> print(lresp(np.array([-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5])))  
[0.          0.33333333  0.66666667  1.          1.          0.41176471
 0.          0.          0.          0.          0.        ]
singleton_instance = None
classmethod get_instance(pacc)[source]
get_response(x)[source]
class irfpy.mima.efficiency0.MimaElevResp(pacc)[source]

Bases: object

Mex/IMA elevation response.

The data is taken from Fig 30 in Barabash et al. 2007.

>>> elres0 = MimaElevResp(0)
>>> elres4 = MimaElevResp(-2000)
>>> print(elres4.get_response(-10))
0.0
>>> elres7 = MimaElevResp(-4000)
>>> print(elres7.get_response(-10))
0.0
g3data = {-4000: array([[-1.80000000e+02,  0.00000000e+00],        [-5.32000000e+00,  0.00000000e+00],        [-5.29453761e+00,  2.70382702e-05],        [-5.00537195e+00,  1.05018428e-04],        [-4.00218365e+00,  4.38386960e-04],        [-2.99639763e+00,  8.98093975e-04],        [-2.00604099e+00,  1.26148335e-03],        [-1.00602574e+00,  1.25622136e-03],        [-2.80256720e-03,  5.19408340e-04],        [ 9.99130463e-01,  3.05828743e-05],        [ 1.05033507e+00,  2.46678093e-05],        [ 1.10000000e+00,  0.00000000e+00],        [ 1.80000000e+02,  0.00000000e+00]]), -2000: array([[-1.80000000e+02,  0.00000000e+00],        [-4.30000000e+00,  0.00000000e+00],        [-4.29434801e+00,  2.56694588e-05],        [-4.00506031e+00,  9.64229762e-05],        [-3.01001384e+00,  3.74671106e-04],        [-2.02092990e+00,  7.45867861e-04],        [-1.01179650e+00,  6.10641996e-04],        [-7.37035947e-03,  1.81583423e-04],        [ 3.69489937e-01,  2.58643104e-05],        [ 5.00000000e-01,  0.00000000e+00],        [ 1.80000000e+02,  0.00000000e+00]]), 0: array([[-1.80000000e+02,  0.00000000e+00],        [-4.64000000e+00,  0.00000000e+00],        [-3.89074346e+00,  2.40146211e-05],        [-3.01121681e+00,  5.20958846e-05],        [-1.99878831e+00,  1.72907115e-04],        [-1.01671298e+00,  2.34880864e-04],        [-1.30321554e-03,  3.44418183e-05],        [ 1.00000000e-01,  0.00000000e+00],        [ 1.80000000e+02,  0.00000000e+00]])}
singleton_instance = {-4000: None, -2000: None, 0: None}
classmethod get_instance(pacc)[source]
get_response(angle_degrees)[source]
class irfpy.mima.efficiency0.MimaEnerResp(Ec)[source]

Bases: object

Energy response for a single channel.

I do not have good reference on it. So that my guess work is here. Generalized Maxwellian with p = 2 and dE=7%. See also Geometic factor.

get_response(energy)[source]
class irfpy.mima.efficiency0.MimaResponse(energy0, elev0, azim0, pacc=- 4000)[source]

Bases: object

IMA response for a “single” channel.

Instance IMA response

Parameters
  • energy0 – The center energy in eV.

  • elev0 – The elevation angle in degrees.

  • azim0 – The azimuth angle in degrees.

  • pacc – Post acceleration in V. -4000, -2000, and 0 is supported

>>> ene = 1000.0
>>> elev0 = 15.0
>>> azim0 = -45.0
>>> respfunc = MimaResponse(ene, elev0, azim0)
>>> print('%.3f' % respfunc(ene, elev0 - 1.5, azim0))   # Maximum elevation hist at -1.5
0.999

Note, it was 0.996 before (using MimaElevResp. Now using MimaElevRespTrapezoid as default)

>>> res = respfunc([999, 1000, 1001], [13, 14, 15], [-46, -45, -44])
>>> print(res.shape)
(3,)

Warning

I have not yet considered plus and minus in the definition of elevatio/azimuth.

get_eresp(ener, normalized2keV=False)[source]

Return the energy response (1D)

If normalized2keV is given, the energy efficiency is normalized by 2 keV g-factor values (see gfactor0 for the relative g-factor). This means that the maximul total efficiency other than 2keV becomes not 1.

get_tresp(theta, cos_corr=False)[source]

Return the elevation response (1D)

get_presp(phi)[source]

Return the azimuth (phi) response (1D)

get_response(ener, theta, phi, normalized2keV=False, cos_corr=False)[source]

Get the responce (3D).

If cos_corr is given, the theta efficiency is multiplied by cos(theta). Usually, the final integral is over the “omgea”, so that domega=cos(theta)dtheta dphi. If cos_corr is set, the integral may be done over theta domain. Use this option only if you understand it.

get_meshed_response(ene1d, theta1d, phi1d, normalized2keV=False, cos_corr=False)[source]

Get the response (3D).

This provides the same interface to get_response(), but faster.

irfpy.mima.efficiency0.doctests()[source]