Skip to content

Commit

Permalink
Merge branch 'spacetelescope:master' into HLA-1076_hap_intro_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
s-goldman authored Nov 6, 2023
2 parents 832e6e5 + 14a4ed4 commit 956257c
Show file tree
Hide file tree
Showing 7 changed files with 521 additions and 273 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ number of the code change for that issue. These PRs can be viewed at:
https://github.com/spacetelescope/drizzlepac/pulls


3.6.2rc0 (unreleased)
3.6.2rc2 (unreleased)
=====================
- At this time pin Astrocut to versions <=0.9 to avoid conflicts with urllib3
package. [#1145]

- Added functionality to allow the use of a two-column poller file. This is used
to update the WFPC2 SVM aperture header keywords from the values in the poller
file.
file. [#1683, #1150]

- Removed the version restriction on matplotlib. [#1649]

Expand Down
2 changes: 1 addition & 1 deletion drizzlepac/haputils/align_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(self, input_list, clobber=False, dqname='DQ', process_type='',
# Apply filter to input observations to insure that they meet minimum criteria for being able to be aligned
log.info(
"{} AlignmentTable: Filter STEP {}".format("-" * 20, "-" * 63))
self.filtered_table = analyze.analyze_data(input_list, type=process_type)
self.filtered_table, _ = analyze.analyze_data(input_list, type=process_type)
log.debug("Input sorted as: \n{}".format(self.filtered_table))

if self.filtered_table['doProcess'].sum() == 0:
Expand Down
27 changes: 20 additions & 7 deletions drizzlepac/haputils/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def mvm_analyze_wrapper(input_filename, log_level=logutil.logging.DEBUG):
log.setLevel(log_level)

# Invoke the low-level analyze_data routine with type = "MVM"
filtered_table = analyze_data([input_filename], type = "MVM")
filtered_table, _ = analyze_data([input_filename], type = "MVM")

# There is only one row in this output table
use_for_mvm = False
Expand Down Expand Up @@ -175,6 +175,9 @@ def analyze_wrapper(input_file_list, log_level=logutil.logging.DEBUG, use_sbchrc
=======
viable_images_list : list
List of images which can be used in the drizzle process.
good_index : list
indices of the viable images in the input_file_list
return_code : int
Numeric code indicative of the status of the analysis of the input data.
Expand All @@ -187,7 +190,7 @@ def analyze_wrapper(input_file_list, log_level=logutil.logging.DEBUG, use_sbchrc
log.setLevel(log_level)

# Analyze the input file list and get the full table assessment
filtered_table = analyze_data(input_file_list, type=type)
filtered_table, analyze_data_good_index = analyze_data(input_file_list, type=type)

# Reduce table to only the data which should be processed (doProcess == 1)
mask = filtered_table["doProcess"] > 0
Expand All @@ -201,6 +204,7 @@ def analyze_wrapper(input_file_list, log_level=logutil.logging.DEBUG, use_sbchrc

good_table = None
good_rows = []
good_index = []
process_list = []
return_value = Ret_code.OK.value

Expand All @@ -210,6 +214,7 @@ def analyze_wrapper(input_file_list, log_level=logutil.logging.DEBUG, use_sbchrc
if filtered_table:
for i, old_row in enumerate(filtered_table):
if old_row["detector"].upper() != "SBC" and old_row["detector"].upper() != "HRC":
good_index.append(i)
good_rows.append(old_row)

# The entire filtered_table contains only SBC or HRC data
Expand All @@ -234,11 +239,11 @@ def analyze_wrapper(input_file_list, log_level=logutil.logging.DEBUG, use_sbchrc
if filtered_table:
# Get the list of all "good" files to use for the alignment
process_list = filtered_table['imageName'].tolist()
good_index = analyze_data_good_index
else:
log.warning("No viable images in single/multi-visit table - no processing done.\n")
return_value = Ret_code.NO_VIABLE_DATA.value

return process_list, return_value
return process_list, good_index, return_value


def analyze_data(input_file_list, log_level=logutil.logging.DEBUG, type=""):
Expand Down Expand Up @@ -268,6 +273,9 @@ def analyze_data(input_file_list, log_level=logutil.logging.DEBUG, type=""):
Astropy Table object containing data pertaining to the associated dataset, including
the do_process bool. It is intended this table is updated by subsequent functions for
bookkeeping purposes.
analyze_data_good_index : list
indices of the viable images in the input_file_list
Notes
=====
Expand Down Expand Up @@ -295,6 +303,8 @@ def analyze_data(input_file_list, log_level=logutil.logging.DEBUG, type=""):
# Set logging level to user-specified level
log.setLevel(log_level)

analyze_data_good_index = []

acs_filt_name_list = [DEFAULT_KEYS['FILKEY1'], DEFAULT_KEYS['FILKEY2']]

# Interpret input filenames and adjust size of column accordingly
Expand Down Expand Up @@ -351,7 +361,7 @@ def analyze_data(input_file_list, log_level=logutil.logging.DEBUG, type=""):
# available for the output table regardless of which keyword is used to
# to determine the data is not viable for alignment.

for input_file in input_file_list:
for i, input_file in enumerate(input_file_list):
header_hdu = 0
header_data = getheader(input_file, header_hdu)

Expand Down Expand Up @@ -521,6 +531,9 @@ def analyze_data(input_file_list, log_level=logutil.logging.DEBUG, type=""):
# processing should be allowed, but there may be some issue with the result (e.g.,
# GYROS mode so some drift)
generate_msg(input_file, msg_type, no_proc_key, no_proc_value)

else:
analyze_data_good_index.append(i)

# Populate a row of the table
output_table.add_row([input_file, instrume, detector, sfilter, aperture, obstype, subarray,
Expand All @@ -530,8 +543,8 @@ def analyze_data(input_file_list, log_level=logutil.logging.DEBUG, type=""):
total_rms, dataset_key, status, fit_qual, headerlet_file,
compromised])
process_msg = ""

return output_table
return output_table, analyze_data_good_index


def generate_msg(filename, msg, key, value):
Expand Down
Loading

0 comments on commit 956257c

Please sign in to comment.