|
45 | 45 | from astropy.stats import median_absolute_deviation, sigma_clipped_stats
|
46 | 46 | from astropy.wcs import WCS
|
47 | 47 | import matplotlib
|
48 |
| -matplotlib.use('Agg') |
49 | 48 | import matplotlib.pyplot as plt
|
50 | 49 | import numpy as np
|
51 | 50 | from photutils.segmentation import detect_sources, detect_threshold
|
52 | 51 | from scipy.ndimage import binary_dilation, generate_binary_structure
|
| 52 | +matplotlib.use('Agg') |
53 | 53 |
|
54 | 54 | warnings.filterwarnings('ignore', message="Input data contains invalid values*") # nan values expected throughout code
|
55 | 55 | warnings.filterwarnings('ignore', message="All-NaN slice encountered*")
|
@@ -133,7 +133,7 @@ def make_segmap(f, seg_from_lw=True, sigma=0.8, npixels=10, dilate_segmap=5, sav
|
133 | 133 | if (seg_from_lw) & ('long' not in detector):
|
134 | 134 | segmap_tmp = np.zeros(segmap_data.shape).astype(int)
|
135 | 135 | wcs = WCS(fits.getheader(f_lw, 'SCI')) # lw cal wcs
|
136 |
| - seg_y, seg_x = np.where(segmap_data!=0) |
| 136 | + seg_y, seg_x = np.where(segmap_data != 0) |
137 | 137 | sky_coords = wcs.pixel_to_world(seg_x, seg_y)
|
138 | 138 | wcs = WCS(fits.getheader(f_sw, 'SCI')) # sw cal wcs
|
139 | 139 | coords = wcs.world_to_pixel(sky_coords)
|
@@ -378,7 +378,7 @@ def subtract_wisp(f, wisp_data, segmap_data=None, sub_wisp=True, gauss_smooth_wi
|
378 | 378 | data_masked = np.copy(data)
|
379 | 379 | wisp_data_masked = np.copy(wisp_data)
|
380 | 380 | data_masked[(dq & 1 != 0) | (segmap_data != 0) | (wisp_mask == 0)] = np.nan
|
381 |
| - wisp_data_masked[(dq & 1 != 0) | (segmap_data != 0) |(wisp_mask == 0)] = np.nan |
| 381 | + wisp_data_masked[(dq & 1 != 0) | (segmap_data != 0) | (wisp_mask == 0)] = np.nan |
382 | 382 |
|
383 | 383 | # Make a version of the original data where only good pixels outside
|
384 | 384 | # the wisp region are unmasked.
|
|
0 commit comments