예제 #1
0
import numpy as np
import scipy.io
import importlib
import common
importlib.reload(common)
from scipy import signal

output_directory = common.set_output_directory('cursor_gaze_movie\\')

is_load_fresh = False

LOC_CODE = np.array([
    [3, 7],  # - uppermost left, lowermost right
    [4, 8],  # - upper left, lower right
    [5, 1],  # - lower left, upper right
    [6, 2]
])  # lowermost left, uppermost right

colour_location = np.array([[0.5, 0.25, 0.6], [1, 0, 1], [1, 0, 0],
                            [1, 0.36, 0], [1, 1, 0], [0, 1, 0], [0, 1, 1],
                            [0, 0, 1]])

mat1 = scipy.io.loadmat(file_name="..\\data_manager\\CheckFiles2\\fname.mat"
                        )  # 'samples', 'GAZE', 'PUPIL', 'type'

CursorData = common.CursorData
dispatch_dictionary = {"CursorData": CursorData}


class Sizes:
    target = 76.9231
예제 #2
0
import scipy.io
import numpy as np
import common
import time
import os
import matplotlib.pyplot as plt
import FieldTrip2
import subprocess

output_directory = common.set_output_directory('prepare_cursor_gaze\\')

start = time.time()

mat = scipy.io.loadmat('..\\visual_input\\movie_cursor_eye\\test.mat')

cursor_xy = mat['CURSOR_XY2'][0, 0]
#np.save(file=output_directory + 'test.npy', arr=cursor_xy)
# #np.savetxt(fname=output_directory + 'test.npy', X=cursor_xy)
# del cursor_xy
# array = np.load(file=output_directory + 'test.npy', allow_pickle=True)
dimensions = cursor_xy.shape


class Number:
    axes = 2
    frames = 360
    trials = 480
    cursors = 3


Number.axes = dimensions[0]
예제 #3
0
    cmd = [executable_path, 'a', output_file, input_path + '/*']
    system = subprocess.Popen(cmd,
                              stderr=subprocess.STDOUT,
                              stdout=subprocess.PIPE)

    try:
        log_print(system.communicate()[0].decode('ascii'))
    except Exception as e:
        # log_print(e)
        log_print('communicate failed?')

    log_print(time.time() - start)


log_output_path = common.set_output_directory("backup_project\\")

executable_path = "D:\\Program Files (x86)\\7za920\\7za"

parent_input_path = 'D:\\JOINT.ACTION\\JointActionRevision\\'
parent_output_path = 'E:\\JOINT_ACTION_BACKUPS\\joint-action-backup-2020.01.19\\'

##

filename = log_output_path + datetime.now().strftime(
    "%Y-%m-%d %H.%M.%S") + '.txt'
f = open(filename, 'w')

directories = get_sorted_subdirectories(parent_input_path)

start = time.time()
import time
import numpy as np
import scipy.io
import matplotlib.pyplot as plt
import matplotlib

matplotlib.use("Qt5Agg")
import importlib
import common

importlib.reload(common)
import pandas as pd
from scipy import stats

output_directory = common.set_output_directory('eye_single_trial\\')

is_generate_heatmaps_and_distance = True

x_edges = np.arange(start=-13, stop=+13, step=.1)
y_edges = np.arange(start=-13, stop=+13, step=.1)

epoch_length1 = 2.5
limit_seconds1 = [[-epoch_length1, 0], [0, +epoch_length1]]
common.Number.frames1 = int(epoch_length1 * common.FS.eye)

plt.hot()


def generate_subject_code():

    subject_code = np.empty([common.Number.subjects, 3])
예제 #5
0
globals().clear()

import pandas as pd
import datetime
from tabulate import tabulate
import numpy as np
from pyarrow import feather
import common

output_directory = common.set_output_directory("casual_hours_calculator\\")


def my_tabulate(results):
    if isinstance(results, type(pd.Series())):
        results = pd.DataFrame(results)
    print(tabulate(results, headers='keys', tablefmt='psql'))


class WorkDay:
    date = None
    timesheet = None
    summary = None

    def __init__(self, date, timesheet, summary):
        self.date = date
        self.timesheet = timesheet
        self.summary = summary


class Summary:
    start = None
예제 #6
0
import pandas as pd
from pdf2image import convert_from_path
import time
import os
import common

output_directory = common.set_output_directory('trajectories\\')

data_path = r'D:\JOINT.ACTION\JointActionRevision\analysis\JointActionStatisticsR2\Figure2_new'

number_of_control = 3
number_of_visibility = 2
number_of_figure = 2

str_control = ['HP Solo', 'LP Solo', 'Joint']
str_visibility = ['Visible', 'Invisible']
str_figure = ["endpoint", "trajectory"]

figure_list = []
i = 0

for VISIBILITY in str_visibility:
    for CONTROL in str_control:
        figure_list.append([VISIBILITY, CONTROL, i])
        i += 1

figure_key = pd.DataFrame(figure_list, columns=['visibility', 'control', 'i'])

for FIGURE in [0]:

    figure_list = []
import numpy as np
import scipy.io
import mat73
import importlib
import common
importlib.reload(common)
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
from scipy import stats
from PIL import Image

output_directory = common.set_output_directory(
    'collate_single_trial_results\\')

## ----- data structures


class SingleTrialValues:
    control_codes = None
    accuracy = None
    RT = None
    MT = None
    curvature = None
    endpoint_displacement = None
    gaze_distance = None
    behavioral_coupling = None
    task_cue = None
    neural_coupling = None

예제 #8
0
import moviepy.video.io.ImageSequenceClip
import os
import common
import time
import numpy as np

output_directory = common.set_output_directory("save_movies\\")

sessions_to_use = np.array(range(0, 20))

for SESSION in sessions_to_use:

    common.print_stars()
    print(SESSION)

    if SESSION == 1:
        print('missing eye data...')
        continue

    start = time.time()

    image_folder = 'D:\\JOINT.ACTION\\JointActionRevision\\analysis\\Unity2\\RESULTS2\\' + common.Labels.session2[SESSION] + '\\'
    image_files = [image_folder + '/' + img for img in os.listdir(image_folder) if img.endswith(".png")]

    clip = moviepy.video.io.ImageSequenceClip.ImageSequenceClip(image_files, fps=30)
    clip.write_videofile(output_directory + common.Labels.session2[SESSION] + '.mp4')

    stop = time.time()
    print(stop-start)