Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions preprocessing/Average_Clip_Per_Day_PupilDetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys
import math
import csv
import logging

### FUNCTIONS ###
def unpack_to_temp(path_to_zipped, path_to_temp):
Expand Down Expand Up @@ -283,30 +284,15 @@ def save_average_clip_images(which_eye, no_of_seconds, save_folder_path, images)
# Write to image file
ret = cv2.imwrite(image_file_path, gray)

###################################
# SCRIPT LOGGER
###################################
# grab today's date
now = datetime.datetime.now()
todays_datetime = datetime.datetime.today().strftime('%Y%m%d-%H%M%S')
logging.basicConfig(filename="PupilDetection_" + todays_datetime + ".log", filemode='w', level=logging.INFO)
### -------------------------------------------- ###
### LET THE ANALYSIS BEGIN!! ###
### log everything in a text file
current_working_directory = os.getcwd()
class Logger(object):
def __init__(self):
# grab today's date
now = datetime.datetime.now()
todays_datetime = datetime.datetime.today().strftime('%Y%m%d-%H%M%S')
log_filename = "PupilDetection_log_" + now.strftime("%Y-%m-%d_%H-%M-%S") + ".txt"
log_file = os.path.join(current_working_directory, log_filename)
self.terminal = sys.stdout
self.log = open(log_file, "a")

def write(self, message):
self.terminal.write(message)
self.log.write(message)

def flush(self):
#this flush method is needed for python 3 compatibility.
#this handles the flush command by doing nothing.
#you might want to specify some extra behavior here.
pass
sys.stdout = Logger()
### ------------------------------------------- ###
# list all folders in Synology drive
# on lab computer
Expand Down
2 changes: 1 addition & 1 deletion preprocessing/AvgWorldCam_video.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### ------------------------------------------------------------------------- ###
# DON'T NEED THIS SCRIPT ANYMORE????
# MAKE INTO A SCRIPT FOR COMPLETENESS
### Create binary files of raw stim vid luminance values fitted to world cam stim vid presentation timings
### use world camera vids for timing, use raw vid luminance values extracted via bonsai
### also save world cam luminance as sanity check/ground truth
Expand Down
4 changes: 4 additions & 0 deletions preprocessing/Video_CSV_profile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
####
# TO DO: TURN INTO SCRIPT
###

import os
import glob
import cv2
Expand Down
2 changes: 1 addition & 1 deletion preprocessing/WorldVid_AvgLum.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### ------------------------------------------------------------------------- ###
# DON'T NEED THIS SCRIPT ANYMORE????
# DEFINITELY NEED THIS SCRIPT!
### Create CSV files with average luminance per frame of stimulus vids
### use world camera vids for timing, stretch and interpolate raw stim vid lum values
### output as data files categorized by calibration, octopus, and unique sequences.
Expand Down
Loading