version: 1


intermediate-data-root: ~/Desktop/soxspipe/intermediate
reduced-data-root: ~/Desktop/soxspipe/reduced

# INTERMEDIATE DATA PRODUCTS CAN CONSUME A LOT OF STORAGE SPACE - BE WARNED
save-intermediate-products: False

# instrument the data belongs to; `xsh` or `soxs`
instrument: xsh
data-extension: 0

soxs-mbias:
    stacked-clipping-sigma: 5
    stacked-clipping-iterations: 5
    clipping-lower-sigma: 3
    clipping-upper-sigma: 3   
    clipping-iteration-count: 5

soxs-mdark:
    stacked-clipping-sigma: 5
    stacked-clipping-iterations: 5
    clipping-lower-sigma: 3
    clipping-upper-sigma: 3   
    clipping-iteration-count: 5

soxs-disp-solution:
    pixel-window-size: 10
    order-deg: 3
    wavelength-deg: 3
    poly-clipping-iteration-limit: 10
    poly-fitting-residual-clipping-sigma: 5

soxs-order-centre:
    # NUMBER OF CROSS-ORDER SLICES PER ORDER
    order-sample-count: 200
    # LENGTH OF EACH SLICE (PIXELS)
    slice-length: 10
    # HEIGHT GAUSSIAN PEAK MUST BE ABOVE MEDIAN FLUX TO BE "DETECTED" BY CODE (STD VIA MEDIAN ABSOLUTE DEVIATION).
    peak-sigma-limit: 3
    # DEGREE OF Y-COMPONENT OF GLOBAL POLYNOMIAL FIT TO ORDER CENTRES
    disp-axis-deg: 3
    # DEGREE OF ORDER-COMPONENT OF GLOBAL POLYNOMIAL FIT TO ORDER CENTRES
    order-deg: 5
    # CLIPPING LIMIT (MEDIAN AND MAD) WHEN FITTING GLOBAL POLYNOMIAL TO ORDER CENTRES
    poly-fitting-residual-clipping-sigma: 3
    # MAXIMUM NUMBER OF CLIPPING ITERATIONS WHEN FITTING GLOBAL POLYNOMIAL TO ORDER CENTRES
    poly-clipping-iteration-limit: 7

soxs-spatial-solution:
    pixel-window-size: 10
    order-deg: 3
    wavelength-deg: 3
    slit-deg: 3
    poly-clipping-iteration-limit: 10
    poly-fitting-residual-clipping-sigma: 5
    map_to_image_displacement_threshold: 0.001 # in pixels


soxs-mflat:
    centre-order-window: 20
    stacked-clipping-sigma: 5
    stacked-clipping-iterations: 5
    clipping-lower-sigma: 50
    clipping-upper-sigma: 1000   
    clipping-iteration-count: 1
    slice-length-for-edge-detection: 90
    slice-width-for-edge-detection: 5
    min-percentage-threshold-for-edge-detection: 20
    max-percentage-threshold-for-edge-detection: 50
    disp-axis-deg: 5
    order-deg: 5
    poly-fitting-residual-clipping-sigma: 2
    poly-clipping-iteration-limit: 5
    low-sensitivity-clipping-simga: 2
    
soxs-stare:
    stacked-clipping-sigma: 5
    stacked-clipping-iterations: 5
    clipping-iteration-count: 1
    clipping-lower-sigma: 50
    clipping-upper-sigma: 1000 

sky-subtraction:
    # MEDIAN CLIPPING FIRST USED TO CLIP MOST DEVIANT PIXELS (BAD AND CRHs)
    median_clipping_sigma: 4.5
    median_clipping_iterations: 3
    # ROLLING WINDOW LENGTH IN DATA POINTS
    median_rolling_window_size: 31
    # PECENTILE CLIPPING USED TO CLIP THE OBJECT(S) BEFORE FITTING A SKY MODEL
    percential_clipping_sigma: 2
    percential_clipping_iterations: 3
    percential_rolling_window_size: 15
    aggressive_object_masking: True
    bspline_order: 3

# UTILS
background-subtraction:
    bspline-deg: 3
    median-filter-pixels: 9

logging settings:
    formatters:
        file_style:
            format: '* %(asctime)s - %(name)s - %(levelname)s (%(pathname)s > %(funcName)s > %(lineno)d) - %(message)s  '
            datefmt: '%Y/%m/%d %H:%M:%S'
        console_style:
            format: '* %(asctime)s - %(levelname)s: %(pathname)s:%(funcName)s:%(lineno)d > %(message)s'
            datefmt: '%H:%M:%S'
        html_style:
            format: '<div id="row" class="%(levelname)s"><span class="date">%(asctime)s</span>   <span class="label">file:</span><span class="filename">%(filename)s</span>   <span class="label">method:</span><span class="funcName">%(funcName)s</span>   <span class="label">line#:</span><span class="lineno">%(lineno)d</span> <span class="pathname">%(pathname)s</span>  <div class="right"><span class="message">%(message)s</span><span class="levelname">%(levelname)s</span></div></div>'
            datefmt: '%Y-%m-%d <span class= "time">%H:%M <span class= "seconds">%Ss</span></span>'
    handlers:
        console:
            class: logging.StreamHandler
            level: DEBUG
            formatter: console_style
            stream: ext://sys.stdout
        file:
            class: logging.handlers.GroupWriteRotatingFileHandler
            level: WARNING
            formatter: file_style
            filename: /Users/Dave/.config/soxspipe/soxspipe.log
            mode: w+
            maxBytes: 102400
            backupCount: 1
    root:
        level: WARNING
        handlers: [file,console]
