Skip to content

psf is not returned in middle #7

@richardgmcmahon

Description

@richardgmcmahon

I have downloaded version 0.3 and psf is for cutout is not centrally located compared with version I downloaded in mid 2014; see 'old' image and new 'image'

This is what I used to get: The image is 25x25 pixels and central pixel is at 12, 12 counting from 0,0
Filename: /data/desardata/Y1A1/DES0449-4706/DES0449-4706_g_psfcat.psf
poldeg: 2
psf_samp: 1.11690831
len(psf_mask.flat): 3750
psf_mask.shape: (1, 6, 25, 25)
psf_mask.type: 3750
psf_image.shape: (25, 25)
Location of maximum value: (12, 12)

Old version of psfex pre version

psfex_test

This is psfex.version: 0.3.0

poldeg: 2
psf_samp: 1.11690831
len(psf_mask.flat): 3750
psf_mask.shape: (1, 6, 25, 25)
psf_mask.type: 3750
psf_image.shape: (29, 29)
Location of maximum value: (13, 13)
Saving: psfex_test.png

psfex_test_new

Also, the output is larger; increasing from 25x25 to 29x29: I assume this related to PSF_SAMP which 1.11690831 in this case; 25x 1.11690831 = 27.92; I assume it is 29 so that the psf can be centred on a pixel sine 28 would put into in the psf centre on a pixel boundary.

This is my test code:

from __future__ import print_function, division

import os

import matplotlib.pyplot as plt

import numpy as np

import psfex
from astropy.io import fits

try:
    print('psfex.__version__: ', psfex.__version__)
except:
   pass

psf_file = '/data/desardata/Y1A1/DES0449-4706/DES0449-4706_g_psfcat.psf'

hdulist = fits.open(psf_file)
hdulist.info()
print(hdulist[0].header)
print(hdulist[1].header)


poldeg =hdulist[1].header['POLDEG1']
print('poldeg: ', poldeg)

psf_samp =hdulist[1].header['PSF_SAMP']
print('psf_samp: ', psf_samp)

data=hdulist[1].data
psf_mask=data['PSF_MASK']

print('len(psf_mask.flat): ', len(psf_mask.flat))
print('psf_mask.shape: ', psf_mask.shape)
print('psf_mask.type:  ', psf_mask.size)


pex = psfex.PSFEx(psf_file)

row=5000
column=5000

psf_image = pex.get_rec(row, column)
print('psf_image.shape: ', psf_image.shape)

imax=np.argmax(psf_image)
xymax = np.unravel_index(imax, psf_image.shape)
print('Location of maximum value: ',xymax)

plt.figure("psfex",figsize=(8.0, 8.0))


plt.imshow(psf_image, interpolation='nearest')
plt.colorbar()
plt.ylabel('Pixels')
plt.xlabel('Pixels')

filename = os.path.basename(psf_file)
title= filename
plt.title(title)

plotfile='psfex_test.png'
print('Saving: ', plotfile)
plt.savefig(plotfile)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions