local_surface_fit

sofia_redux.instruments.fifi_ls.resample.local_surface_fit(combined, grid_info, window=None, adaptive_threshold=None, adaptive_algorithm='scaled', error_weighting=True, smoothing=None, order=2, robust=None, neg_threshold=None, fit_threshold=None, edge_threshold=None, skip_uncorrected=False, jobs=None, check_memory=True)[source]

Resamples combined data on regular grid using local polynomial fitting.

Parameters:
combineddict

Dictionary containing combined data. Returned from combine_files.

grid_infodict

Dictionary containing output grid coordinates and other necessary information. Returned from get_grid_info.

windowarray_like of float, optional

Region to consider for local polynomial fits, given as a factor of the mean FWHM, in the (x, y, w) dimensions. Default is (3.0, 3.0, 0.5).

adaptive_thresholdarray_like of float, optional

If > 0, determines how the adaptive smoothing algorithm will attempt to fit data. The optimal value is 1. Will automatically enable both distance and error weighting. For dimensions that have adaptive smoothing enabled, smoothing should be set to the Gaussian width of the data in units of window. For other dimensions not using adaptive smoothing, smoothing has the usual definition. Adaptive smoothing is disabled by default: (0.0, 0.0, 0.0).

adaptive_algorithm{‘scaled’, ‘shaped’}, optional

Determines the type of variation allowed for the adaptive kernel. If ‘scaled’, only the kernel size is allowed to vary. If ‘shaped’, kernel shape may also vary.

error_weightingbool, optional

If True, errors will be used to weight the flux fits.

smoothingarray_like of float, optional

Distance over which to smooth the data, given as a factor of the mean FWHM, in the (x, y, w) dimensions. If adaptive_threshold is set for a certain dimension, smoothing should be set to 1.0 for that dimension. Default is (1.75, 1.75, 0.25).

orderint or array of int, optional

Maximum order of local polynomial fits, in the (x, y, w) dimensions.

robustfloat, optional

Rejection threshold for input data to local fits, given as a factor of the standard deviation.

neg_thresholdfloat, optional

First-pass rejection threshold for negative input data, given as a factor of the standard deviation; if None or <= 0, first-pass rejection will not be performed.

fit_thresholdfloat, optional

Rejection threshold for output fit values, given as a factor of the standard deviation in the input data. If exceeded, weighted mean value is used in place of fit.

edge_thresholdarray_like of float, optional

Threshold for edge marking for (x, y, w) dimensions. Values should be between 0 and 1; higher values mean more edge pixels marked. Default is (0.7, 0.7, 0.5).

skip_uncorrected: bool, optional

If set, the uncorrected flux cube will not be computed, even if present in the input data. This option is primarily intended for testing or quicklook, when the full data product is not needed.

jobsint, optional

Specifies the maximum number of concurrently running jobs. Values of 0 or 1 will result in serial processing. A negative value sets jobs to n_cpus + 1 + jobs such that -1 would use all cpus, and -2 would use all but one cpu.

check_memorybool, optional

If set, expected memory use will be checked and used to limit the number of jobs if necessary.