Skip to content

Commit

Permalink
Removing unused function to prepare to update to numpy 2
Browse files Browse the repository at this point in the history
  • Loading branch information
menanteau committed Jan 28, 2025
1 parent 9ea7ca0 commit b713b64
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion python/HeaderService/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.

__author__ = "LSST/Felipe Menanteau"
__version__ = "3.4.10"
__version__ = "3.4.11"
version = __version__

from . import hutils
Expand Down
30 changes: 0 additions & 30 deletions python/HeaderService/hutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,36 +583,6 @@ def write_header_fits(self, filename):
hdr = copy.deepcopy(self.header[extname])
fits.write(data, header=hdr, extname=extname)

def write_dummy_fits(self, filename, dtype='random', naxis1=None, naxis2=None, btype='int32'):

"""
Write a dummy fits file filled with random or zeros
-- use for testing only
"""

t0 = time.time()
with fitsio.FITS(filename, 'rw', clobber=True, ignore_empty=True) as fits:

# Write the PRIMARY First, with no data
data = None
hdr = copy.deepcopy(self.header['PRIMARY'])
fits.write(data, header=hdr, extname='PRIMARY')

# Loop over the extensions
for extname in self.HDRLIST[1:]:
if dtype == 'random':
data = numpy.random.uniform(1, 2**18-1, size=(naxis2, naxis1)).astype(btype)
elif dtype == 'zero' or dtype == 'zeros':
data = numpy.zeros((naxis2, naxis1)).astype(btype)
elif dtype == 'seq' or dtype == 'sequence':
data = numpy.zeros((naxis2, naxis1)).astype(btype) + int(extname[-2:])
else:
raise NameError(f"Data Type: '{dtype}' not implemented")
hdr = copy.deepcopy(self.header[extname])
self.log.debug(f"Writing: {extname}".format(extname))
fits.write(data, extname=extname, header=hdr)
self.log.info("FITS write time:{}".format(elapsed_time(t0)))

def write_header(self, filename):
"""
Writes single header file using the strict FITS format (i.e. empty
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# The main call
setup(name='HeaderService',
version='3.4.10',
version='3.4.11',
license="GPL",
description="LSST Meta-data aggregator for FITS header service",
author="LSST, Felipe Menanteau",
Expand Down

0 comments on commit b713b64

Please sign in to comment.