Skip to content

Commit

Permalink
Log WFCam errors and bump swarp memory (#884)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdstein authored May 10, 2024
1 parent 9ac5a07 commit 2177e0d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mirar/pipelines/winter/config/files/config.swarp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ BACK_FILTERSIZE 6 # Background map filter range (meshes)
#------------------------------ Memory management -----------------------------

VMEM_DIR . # Directory path for swap files
VMEM_MAX 2047 # Maximum amount of virtual memory (MB)
MEM_MAX 256 # Maximum amount of usable RAM (MB)
COMBINE_BUFSIZE 256 # RAM dedicated to co-addition(MB)
VMEM_MAX 4012 # Maximum amount of virtual memory (MB)
MEM_MAX 2056 # Maximum amount of usable RAM (MB)
COMBINE_BUFSIZE 2056 # RAM dedicated to co-addition(MB)

#------------------------------ Miscellaneous ---------------------------------

Expand All @@ -94,3 +94,5 @@ VERBOSE_TYPE NORMAL # QUIET,NORMAL or FULL
NTHREADS 0 # Number of simultaneous threads for
# the SMP version of SWarp
# 0 = automatic

NOPENFILES_MAX 512 # Maximum number of files opened by SWarp
11 changes: 11 additions & 0 deletions mirar/references/wfcam/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Utility functions for WFCAM
"""

import logging
from pathlib import Path

import numpy as np
Expand Down Expand Up @@ -35,6 +36,8 @@
QUERY_DEC_KEY = "QRY_DEC"
QUERY_FILT_KEY = "QRY_FILT"

logger = logging.getLogger(__name__)


def get_query_coordinates_from_header(
header: fits.Header, numpoints: int = 1
Expand Down Expand Up @@ -243,6 +246,14 @@ def open_compressed_wfcam_fits(path: Path) -> tuple[np.ndarray, fits.Header]:
:return: data, header
"""
_, extension_data_list, extension_header_list = open_mef_fits(path)
if len(extension_data_list) == 0:
err = f"Compressed fits file {path} has no extensions."
logger.error(err)
raise ValueError(err)
if len(extension_data_list) != 1:
err = f"Compressed fits file {path} has more than one extension."
logger.error(err)
raise ValueError(err)
return extension_data_list[0], extension_header_list[0]


Expand Down

0 comments on commit 2177e0d

Please sign in to comment.