# -*- coding: utf-8 -*-
"""
Created on Fri Nov 28 17:04:39 2025

@author: Jiawen Jiang

This is a configuration script containing all the required parameters, specific 
to a dataset. Modify this script for new dataset.

"""

#%% file paths
stack1gata_fp = r'E:\05.12.25 piv fish 2\piv 1\Red'
stack1gfp_fp = r'E:\05.12.25 piv fish 2\gfp 1\Green'
stack2gata_fp = r'E:\05.12.25 piv fish 2\piv 2\Red'
stack2gfp_fp = r'E:\05.12.25 piv fish 2\gfp 2\Green'

stack1gata_image = stack1gata_fp + r'\*.tif'
stack1gata_plist = stack1gata_fp + r'\*.plist'

stack1gfp_image = stack1gfp_fp + r'\*.tif'
stack1gfp_plist = stack1gfp_fp + r'\*.plist'

stack2gata_image = stack2gata_fp + r'\*.tif'
stack2gata_plist = stack2gata_fp + r'\*.plist'

stack2gfp_image = stack2gfp_fp + r'\*.tif'
stack2gfp_plist = stack2gfp_fp + r'\*.plist'
#%% stack registration parameters
xlength = 400 #length in x, pixels
um_per_pixel = 0.431 #size of a pixel in um
#xlength = xlength*um_per_pixel #in unit um
ylength = 404 #in unit pixel
zheight = 279 #height of the zstack in pixels
midz = 855 #midpoint of z positions
stack_phase = 1.1 #phase of stack1 gata
stack_phase_wall = 1.1 #phase of stack1 gfp
plane_phase = 5.3 #phase of stack2 gata
plane_phase_wall = 5.3 #phase of stack2 gfp
phase_range = 0.05 #range within which frame pairs are selected
all_phases = False #whether to analyse entire heart beat
pair_selection_condition_stack1 = 0 #1 or 0 depending on whether even or odd frame numbers are first in a pair
pair_selection_condition_stack2 = 1
frame_pair_limit = 25 #how many frame pairs to select for correlation averaging PIV
nplanes=31 #how many imaging planes
plane_sep = 4 #separation between imaging planes, in um
rotation = -19.1 #rotation angle in degrees between two stacks
nofrows = 25 #how many rows of vectors in y, could be changed to get different field resolution
stack_shift = (-1.7*um_per_pixel,1.7*um_per_pixel) #shift in stack1 in [x,z] measured from spatial registration
y_shift = 0.4 #shift in y direction of stack2
SW_size = [56,56] #size of search window in pixels
IW_size = [24,24] #size of interrogation window in pixels 
SNR_p2m_threshold = 1.01
SNR_p2p_threshold = 1.01
#bootstrap_samplesize = 20
bootstrap_iteration = 3000
phase_shift = 4.2








