コード例 #1
0
def run_benchmark():
    # Set up data store and select N_OBS times the observation OBS_ID
    data_store = DataStore.from_dir('$GAMMAPY_EXTRA/test_datasets/cta_1dc/')
    obs_ids = OBS_ID * np.ones(N_OBS)
    obs_list = data_store.obs_list(obs_id=obs_ids)

    target_position = SkyCoord(0, 0, unit='deg', frame='galactic')
    on_radius = 0.2 * u.deg
    on_region = CircleSkyRegion(center=target_position, radius=on_radius)

    bkg_estimator = RingBackgroundEstimator(
        r_in=0.5 * u.deg,
        width=0.2 * u.deg,
    )

    # Define reference image centered on the target
    xref = target_position.galactic.l.value
    yref = target_position.galactic.b.value

    ref_image = SkyImage.empty(
        nxpix=800,
        nypix=600,
        binsz=0.02,
        xref=xref,
        yref=yref,
        proj='TAN',
        coordsys='GAL',
    )

    exclusion_mask = ref_image.region_mask(on_region)
    exclusion_mask.data = 1 - exclusion_mask.data

    image_estimator = IACTBasicImageEstimator(
        reference=ref_image,
        emin=100 * u.GeV,
        emax=100 * u.TeV,
        offset_max=3 * u.deg,
        background_estimator=bkg_estimator,
        exclusion_mask=exclusion_mask,
    )
    result = image_estimator.run(obs_list)
コード例 #2
0
def run_benchmark():
    # Set up data store and select N_OBS times the observation OBS_ID
    data_store = DataStore.from_dir('$GAMMAPY_EXTRA/test_datasets/cta_1dc/')
    obs_ids = OBS_ID * np.ones(N_OBS)
    obs_list = data_store.obs_list(obs_id=obs_ids)

    target_position = SkyCoord(0, 0, unit='deg', frame='galactic')
    on_radius = 0.2 * u.deg
    on_region = CircleSkyRegion(center=target_position, radius=on_radius)

    bkg_estimator = RingBackgroundEstimator(
        r_in=0.5 * u.deg,
        width=0.2 * u.deg,
    )

    # Define reference image centered on the target
    xref = target_position.galactic.l.value
    yref = target_position.galactic.b.value

    ref_image = SkyImage.empty(
        nxpix=800, nypix=600, binsz=0.02,
        xref=xref, yref=yref,
        proj='TAN', coordsys='GAL',
    )

    exclusion_mask = ref_image.region_mask(on_region)
    exclusion_mask.data = 1 - exclusion_mask.data

    image_estimator = IACTBasicImageEstimator(
        reference=ref_image,
        emin=100 * u.GeV,
        emax=100 * u.TeV,
        offset_max=3 * u.deg,
        background_estimator=bkg_estimator,
        exclusion_mask=exclusion_mask,
    )
    result = image_estimator.run(obs_list)
コード例 #3
0
ファイル: LMC_makeimage.py プロジェクト: AtreyeeS/LMC
    exclusion_mask.data -= ref_image.region_mask(off)

exclusion_mask.data[exclusion_mask.data<0]=0    #overlapping pixels go to negative values. Fixing them to zero
exclusion_mask.plot(add_cbar=True)

bkg_estimator = FoVBackgroundEstimator()


emin=0.5 * u.TeV
emax=20 * u.TeV
offset_max=2.3 * u.deg

image_estimator = IACTBasicImageEstimator(
    reference=ref_image,
    emin=emin,
    emax=emax,
    offset_max=offset_max,
    background_estimator=bkg_estimator,
    exclusion_mask=exclusion_mask)


def indiv():

    images=image_estimator.run_indiv(mylist)

    backnorm=[]
    for im in images:
        backnorm.append(im["background"].meta['NORM'])

def summed():
コード例 #4
0
ファイル: make_images.py プロジェクト: AtreyeeS/LMC
exclusion_mask = ref_image.region_mask(off_regions[0])
exclusion_mask.data = 1 - exclusion_mask.data
for off in off_regions[1:]:
    exclusion_mask.data -= ref_image.region_mask(off)

exclusion_mask.data[exclusion_mask.data < 0] = 0
bkg_estimator = FoVBackgroundEstimator()

emin = 0.5 * u.TeV
emax = 20 * u.TeV
offset_max = 2.3 * u.deg

image_estimator = IACTBasicImageEstimator(reference=ref_image,
                                          emin=emin,
                                          emax=emax,
                                          offset_max=offset_max,
                                          background_estimator=bkg_estimator,
                                          exclusion_mask=exclusion_mask)

images = image_estimator.run_indiv(mylist)

fermi = "FDA16.fits"
diffuse = SkyImage.read(fermi)
diffuse_rep = diffuse.reproject(ref_image)

#make exclusion and cutouts

exc_list = []
diffuse_list = []

for i in range(len(mylist)):
コード例 #5
0
# In[11]:

exclusion_mask = ref_image.region_mask(on_region)
exclusion_mask.data = 1 - exclusion_mask.data
exclusion_mask.plot()

# In[12]:

bkg_estimator = RingBackgroundEstimator(
    r_in=0.5 * u.deg,
    width=0.2 * u.deg,
)
image_estimator = IACTBasicImageEstimator(
    reference=ref_image,
    emin=100 * u.GeV,
    emax=100 * u.TeV,
    offset_max=3 * u.deg,
    background_estimator=bkg_estimator,
    exclusion_mask=exclusion_mask,
)
images = image_estimator.run(obs_list)
images.names

# ### Show images
#
# Let's define a little helper function and then show all the resulting images that were computed.

# In[13]:


def show_image(image, radius=3, vmin=0, vmax=3):
    """Little helper function to show the images for this application here."""