コード例 #1
0
ファイル: abell85.py プロジェクト: lucabaldini/ximpol
ROI_MODEL = xROIModel(10.4075, -9.3425)

# Read in the spectral models.
spectral_model_spline = parse_spectral_model('Abell_85.txt')

def energy_spectrum(E, t):
    return spectral_model_spline(E)

polarization_degree = constant(0.)
polarization_angle = constant(0.)

#abell85 = xPointSource('Abell 85', ROI_MODEL.ra, ROI_MODEL.dec,
#                       energy_spectrum, polarization_degree, polarization_angle)

img_file_path = os.path.join(XIMPOL_CONFIG, 'fits', 'abell85.fits')
abell85 = xExtendedSource('Abell 85', img_file_path, energy_spectrum,
                          polarization_degree, polarization_angle)


ROI_MODEL.add_source(abell85)


def display():
    """Display the source model.
    """
    from ximpol.utils.matplotlib_ import pyplot as plt
    from ximpol.srcmodel.img import xFITSImage

    print(ROI_MODEL)
    fig = plt.figure('Energy spectrum')
    spectral_model_spline.plot(logy=True, show=False, label='Total')
    
コード例 #2
0
for i,base_name in enumerate(base_names):
    energy_spectrum = power_law(9.59/len(base_names), 2.108) # This ineeds to be checked!
    
    pol_mapx_path = os.path.join(XIMPOL_CONFIG, 'fits', '%s_x.fits' % base_name)
    pol_mapy_path = os.path.join(XIMPOL_CONFIG, 'fits', '%s_y.fits' % base_name)
    polarization_map = xPolarizationMap(pol_mapx_path, pol_mapy_path)
    polarization_maps.append(polarization_map)
    def nebula_polarization_angle(E, t, ra, dec):
        return polarization_map.polarization_angle(ra, dec)

    def nebula_polarization_degree(E, t, ra, dec):
        return polarization_map.polarization_degree(ra, dec)
    
    _source=xExtendedSource('Crab Nebula (%d)' % i,
                            img_file_path,
                            energy_spectrum,
                            nebula_polarization_degree,
                            nebula_polarization_angle)
    ROI_MODEL.add_source(_source)
    pass



if __name__ == '__main__':
    print(ROI_MODEL)

def display():
    """Display the source model.
    """
    from ximpol.utils.matplotlib_ import pyplot as plt
    from ximpol.srcmodel.img import xFITSImage
コード例 #3
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


import numpy
import os

from ximpol.srcmodel.roi import xExtendedSource, xROIModel
from ximpol.srcmodel.spectrum import power_law
from ximpol.srcmodel.polarization import constant
from ximpol import XIMPOL_CONFIG


ROI_MODEL = xROIModel(83.633083, 22.014500)

img_file_path = os.path.join(XIMPOL_CONFIG, 'fits', 'crab_0p3_10p0_keV.fits')
energy_spectrum = power_law(10., 2.)
polarization_degree = constant(0.157)
polarization_angle = constant(numpy.radians(161.1))
crab_nebula = xExtendedSource('Crab nebula', img_file_path, energy_spectrum,
                              polarization_degree, polarization_angle)

ROI_MODEL.add_source(crab_nebula)


if __name__ == '__main__':
    print(ROI_MODEL)
コード例 #4
0
ファイル: tycho.py プロジェクト: lucabaldini/ximpol
# Read the polarization maps for the non-thermal component.
pol_mapx_path = os.path.join(XIMPOL_CONFIG, 'fits', 'tycho_x.fits')
pol_mapy_path = os.path.join(XIMPOL_CONFIG, 'fits', 'tycho_y.fits')
polarization_map = xPolarizationMap(pol_mapx_path, pol_mapy_path)


def nonthermal_polarization_angle(E, t, ra, dec):
    return polarization_map.polarization_angle(ra, dec)

def nonthermal_polarization_degree(E, t, ra, dec):
    return polarization_map.polarization_degree(ra, dec)


thermal_component = xExtendedSource('Tycho thermal', le_img_file_path,
                                    thermal_energy_spectrum,
                                    thermal_polarization_degree,
                                    thermal_polarization_angle)
nonthermal_component = xExtendedSource('Tycho non-thermal', he_img_file_path,
                                       nonthermal_energy_spectrum,
                                       nonthermal_polarization_degree,
                                       nonthermal_polarization_angle)


ROI_MODEL.add_sources(thermal_component, nonthermal_component)


def display():
    """Display the source model.
    """
    from ximpol.utils.matplotlib_ import pyplot as plt
    print(ROI_MODEL)
コード例 #5
0
ファイル: casa.py プロジェクト: pabell/ximpol
pol_mapx_path = os.path.join(XIMPOL_CONFIG, 'fits', 'casa_x.fits')
#pol_mapy_path = os.path.join(XIMPOL_CONFIG, 'fits', 'casa_50_y.fits')
pol_mapy_path = os.path.join(XIMPOL_CONFIG, 'fits', 'casa_y.fits')
polarization_map = xPolarizationMap(pol_mapx_path, pol_mapy_path)


def nonthermal_polarization_angle(E, t, ra, dec):
    return polarization_map.polarization_angle(ra, dec)


def nonthermal_polarization_degree(E, t, ra, dec):
    return polarization_map.polarization_degree(ra, dec)


thermal_component = xExtendedSource('Cas A thermal', le_img_file_path,
                                    thermal_energy_spectrum,
                                    thermal_polarization_degree,
                                    thermal_polarization_angle)
nonthermal_component = xExtendedSource('Cas A non-thermal', he_img_file_path,
                                       nonthermal_energy_spectrum,
                                       nonthermal_polarization_degree,
                                       nonthermal_polarization_angle)

ROI_MODEL.add_sources(thermal_component, nonthermal_component)


def display():
    """Display the source model.
    """
    from ximpol.utils.matplotlib_ import pyplot as plt
    from ximpol.srcmodel.img import xFITSImage
コード例 #6
0
ファイル: crab_nebula.py プロジェクト: lucabaldini/ximpol
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


import numpy
import os

from ximpol.srcmodel.roi import xExtendedSource, xROIModel
from ximpol.srcmodel.spectrum import power_law
from ximpol.srcmodel.polarization import constant
from ximpol import XIMPOL_CONFIG


ROI_MODEL = xROIModel(83.633083, 22.014500)

img_file_path = os.path.join(XIMPOL_CONFIG, 'fits', 'crab_0p3_10p0_keV.fits')
energy_spectrum = power_law(9.59, 2.108)
polarization_degree = constant(0.157)
polarization_angle = constant(numpy.radians(161.1))
crab_nebula = xExtendedSource('Crab nebula', img_file_path, energy_spectrum,
                              polarization_degree, polarization_angle)

ROI_MODEL.add_source(crab_nebula)


if __name__ == '__main__':
    print(ROI_MODEL)