@@ -389,36 +389,42 @@ def subtract_starfield_background_task(data_object: NDCube,
389389 union_wcs , union_shape = find_optimal_celestial_wcs (
390390 [(shape_before , wcs_celestial_before ),
391391 (shape_after , wcs_celestial_after )],
392- auto_rotate = False )
392+ auto_rotate = False , projection = "CAR" )
393393
394394 starfield_reprojected_before = reproject_interp (
395- (star_datacube_before .data , wcs_celestial_before ),
395+ (np .stack ([star_datacube_before .data , star_datacube_before .uncertainty .array ], axis = 0 ),
396+ wcs_celestial_before ),
396397 union_wcs ,
397398 shape_out = union_shape ,
398399 return_footprint = False )
399400
400401 starfield_reprojected_after = reproject_interp (
401- (star_datacube_after .data , wcs_celestial_after ),
402+ (np .stack ([star_datacube_after .data , star_datacube_after .uncertainty .array ], axis = 0 ),
403+ wcs_celestial_after ),
402404 union_wcs ,
403405 shape_out = union_shape ,
404406 return_footprint = False )
405407
406- # TODO - uncertainty!
407- starfield_before = NDCube (data = starfield_reprojected_before , wcs = union_wcs , meta = star_datacube_before .meta )
408- starfield_after = NDCube (data = starfield_reprojected_after , wcs = union_wcs , meta = star_datacube_after .meta )
409-
410- starfield_data_interpolated = interpolate_data (starfield_before ,
411- starfield_after ,
412- data_object .meta .datetime ,
413- allow_extrapolation = False ,
414- and_uncertainty = False )
408+ starfield_before = NDCube (data = starfield_reprojected_before [0 ],
409+ uncertainty = StdDevUncertainty (starfield_reprojected_before [1 ]),
410+ wcs = union_wcs , meta = star_datacube_before .meta )
411+ starfield_after = NDCube (data = starfield_reprojected_after [0 ],
412+ uncertainty = StdDevUncertainty (starfield_reprojected_after [1 ]),
413+ wcs = union_wcs , meta = star_datacube_after .meta )
414+
415+ starfield_data_interpolated , starfield_uncert_interpolated = interpolate_data (starfield_before ,
416+ starfield_after ,
417+ data_object .meta .datetime ,
418+ allow_extrapolation = False ,
419+ and_uncertainty = True ,
420+ infill_nans = True )
415421 # TODO - metadata...
416- star_datacube = NDCube (data = starfield_data_interpolated , uncertainty = None , wcs = union_wcs ,
417- meta = star_datacube_before .meta )
422+ star_datacube = NDCube (data = starfield_data_interpolated ,
423+ uncertainty = StdDevUncertainty (starfield_uncert_interpolated ),
424+ wcs = union_wcs ,
425+ meta = star_datacube_before .meta )
418426 wcs_celestial = union_wcs
419427
420- # TODO - missing spots in one starfield, take any good data. Maybe add into interpolation code...
421-
422428 original_mask = data_object .data == 0
423429
424430 # TODO - Think about where to do the interpolation at this stage...
0 commit comments