CosmoStat / shapepipe

Shape Measurement Pipeline
MIT License
17 stars 13 forks source link

[NEW FEATURE]Change postage stamp size #611

Open lbaumo opened 1 year ago

lbaumo commented 1 year ago

Are we losing bright galaxies because the postage stamp is too small? We should have the postage stamp scale with the galaxy size above a certain threshold.

lbaumo commented 1 year ago

add some modification of these functions to the vignet module:

` def get_sigma_size(cat):

fwhm_fac = 2*numpy.sqrt(2*numpy.log(2))
ellipticity = 1.0 - cat['b_world']/cat['a_world']
sigma = cat['flux_radius']*2/fwhm_fac
drad = sigma*5
drad = drad*(1.0 + ellipticity)
drad = numpy.ceil(drad)
sigma_size = 2*drad.astype('i4') # sigma size is twice the radius           
print "returning sigma size"
return sigma_size

`

`def get_box_sizes(cat):

#get box sizes that are wither 2**N or 3*2**N, within                        
#the limits set by the user                                                  

min_box_size = 32
max_box_size = 256
sigma_size = get_sigma_size(cat)
# now do row and col sizes                                                  
row_size = cat['ymax_image'] - cat['ymin_image'] + 1
col_size = cat['xmax_image'] - cat['xmin_image'] + 1

# get max of all three                                                      
box_size = numpy.vstack((col_size,row_size,sigma_size)).max(axis=0)

# clip to range                                                             
box_size = box_size.clip(min_box_size,max_box_size)
return box_size

`

aguinot commented 1 year ago

That is a good idea! Just a small warning, all the code has been done with odd size postage stamp. As you have written right now the sigma_size will always be an even number. It is possible that it creates some issues latter on. That needs to be checked.