Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing unused function to prepare to update to numpy 2 #147

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
31 changes: 0 additions & 31 deletions python/HeaderService/hutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import time
import fitsio
import yaml
import numpy
import logging
from logging.handlers import RotatingFileHandler
import hashlib
Expand Down Expand Up @@ -583,36 +582,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