utils.py
- General utils¶
General utility functions called from various parts of the code.
-
everest.utils.
AP_COLLAPSED_PIXEL
= 9¶ Marks a pixel into which a row was collapsed. Note that
AP_COLLAPSED_PIXEL & 1 = 1
-
everest.utils.
AP_SATURATED_PIXEL
= 8¶ Marks a saturated pixel that was masked out. Note that
AP_SATURATED_PIXEL & 1 = 0
-
class
everest.utils.
DataContainer
¶ A generic data container. Nothing fancy here.
-
everest.utils.
ExceptionHook
(exctype, value, tb)¶ A custom exception handler that logs errors to file.
-
everest.utils.
ExceptionHookPDB
(exctype, value, tb)¶ A custom exception handler, with
pdb
post-mortem for debugging.
-
class
everest.utils.
Formatter
¶ Custom function formatters for displaying ticks on plots.
-
CDPP
= <matplotlib.ticker.FuncFormatter object>¶ Integer formatter for a CDPP axis
-
CDPP1F
= <matplotlib.ticker.FuncFormatter object>¶ Floating point formatter for a CDPP axis (1 digit after decimal)
-
CDPP2F
= <matplotlib.ticker.FuncFormatter object>¶ Floating point formatter for a CDPP axis (2 digits after decimal)
-
Chunk
= <matplotlib.ticker.FuncFormatter object>¶ Integer formatter for chunk number
-
Flux
= <matplotlib.ticker.FuncFormatter object>¶ Integer formatter for a flux axis
-
-
class
everest.utils.
FunctionWrapper
(f, *args, **kwargs)¶ A simple function wrapper class. Stores
args
andkwargs
and allows an arbitrary function to be called with a single parameterx
-
everest.utils.
InitLog
(file_name=None, log_level=10, screen_level=50, pdb=False)¶ A little routine to initialize the logging functionality.
Parameters:
-
class
everest.utils.
NoPILFilter
(name='')¶ The
PIL
image module has a nasty habit of sending all sorts of unintelligible information to the logger. We filter that out here.
-
everest.utils.
prange
(*x)¶ Progress bar range with tqdm
-
everest.utils.
sort_like
(l, col1, col2)¶ Sorts the list
l
by comparingcol2
tocol1
. Specifically, finds the indicesi
such thatcol2[i] = col1
and returnsl[i]
. This is useful when comparing the CDPP values of catalogs generated by different pipelines. The target IDs are all the same, but won’t necessarily be in the same order. This allowseverest
to sort the CDPP arrays so that the targets match.Parameters: - l (array_like) – The list or array to sort
- col1 (array_like) – A list or array (same length as
l
) - col2 (array_like) – A second list or array containing the same elements as
col1
but in a different order