Skip to content

Commit

Permalink
Merge branch 'noboost' into #755
Browse files Browse the repository at this point in the history
  • Loading branch information
rmjarvis committed May 6, 2018
2 parents 49b5bc3 + 55ed29f commit b0ab363
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
71 changes: 71 additions & 0 deletions devel/lsst/check_flats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Copyright (c) 2012-2018 by the GalSim developers team on GitHub
# https://github.com/GalSim-developers
#
# This file is part of GalSim: The modular galaxy image simulation toolkit.
# https://github.com/GalSim-developers/GalSim
#
# GalSim is free software: redistribution and use in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions, and the disclaimer given in the accompanying LICENSE
# file.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions, and the disclaimer given in the documentation
# and/or other materials provided with the distribution.
#

from __future__ import print_function
import fitsio
import numpy as np


def cov(a, b):
return np.mean( (a - np.mean(a)) * (b - np.mean(b)) )

var = cov01 = cov10 = cov11a = cov11b = cov02 = cov20 = cov03 = cov30 = cov0x = covx0 = n = 0

for i in range(10):
flat0 = fitsio.read('flat{:02d}.fits'.format(i))
print('mean ',i,' = ',flat0.mean())
for j in range(i+1,10):
flat1 = fitsio.read('flat{:02d}.fits'.format(j))

diff = flat1 - flat0
var += diff.var()
cov01 += cov(diff[1:,:], diff[:-1,:])
cov10 += cov(diff[:,1:], diff[:,:-1])
cov11a += cov(diff[1:,1:], diff[:-1,:-1])
cov11b += cov(diff[1:,:-1], diff[:-1,1:])
cov02 += cov(diff[2:,:], diff[:-2,:])
cov20 += cov(diff[:,2:], diff[:,:-2])
cov03 += cov(diff[3:,:], diff[:-3,:])
cov30 += cov(diff[:,3:], diff[:,:-3])
cov0x += cov(diff[10:,:], diff[:-10,:])
covx0 += cov(diff[:,10:], diff[:,:-10])
n += 1

var /= n
cov01 /= n
cov10 /= n
cov11a /= n
cov11b /= n
cov02 /= n
cov20 /= n
cov03 /= n
cov30 /= n
cov0x /= n
covx0 /= n

print('var(diff)/2 = ',var/2)
print('cov01 = ',cov01)
print('cov10 = ',cov10)
print('cov11a = ',cov11a)
print('cov11b = ',cov11b)
print('cov02 = ',cov02)
print('cov20 = ',cov20)
print('cov03 = ',cov03)
print('cov30 = ',cov30)
print('cov0x = ',cov0x)
print('covx0 = ',covx0)
45 changes: 45 additions & 0 deletions devel/lsst/test_bf_direction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) 2012-2018 by the GalSim developers team on GitHub
# https://github.com/GalSim-developers
#
# This file is part of GalSim: The modular galaxy image simulation toolkit.
# https://github.com/GalSim-developers/GalSim
#
# GalSim is free software: redistribution and use in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions, and the disclaimer given in the accompanying LICENSE
# file.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions, and the disclaimer given in the documentation
# and/or other materials provided with the distribution.
#

from __future__ import print_function
import galsim

obj = galsim.Gaussian(flux=3.539e6, sigma=0.1)

rng = galsim.BaseDeviate(5678)
silicon = galsim.SiliconSensor(rng=rng)

im = obj.drawImage(nx=17, ny=17, scale=0.3, dtype=float, method='phot', sensor=silicon)
im.setCenter(0,0)
im.write('test.fits')

print('im min = ',im.array.min())
print('im max = ',im.array.max())
print('im(0,0) = ',im(0,0))
print('+- 1 along column: ',im(0,1),im(0,-1))
print('+- 1 along row: ',im(1,0),im(-1,0))

area_image = silicon.calculate_pixel_areas(im)
area_image.write('area.fits')
print('area min = ',area_image.array.min())
print('area max = ',area_image.array.max())
print('area(0,0) = ',area_image(0,0))

print('+- 1 along column: ',area_image(0,1),area_image(0,-1))
print('+- 1 along row: ',area_image(1,0),area_image(-1,0))

0 comments on commit b0ab363

Please sign in to comment.