Skip to content

Commit

Permalink
Merge branch 'dev' into feature/clustering
Browse files Browse the repository at this point in the history
  • Loading branch information
Farzaneh Najafi committed Apr 2, 2021
2 parents 756f3cc + 702e375 commit 4776e83
Show file tree
Hide file tree
Showing 32 changed files with 2,582 additions and 848 deletions.
19 changes: 10 additions & 9 deletions scripts/create_multi_session_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@
import visual_behavior.ophys.io.create_multi_session_df as io



if __name__ == '__main__':
import sys
project_code = sys.argv[1][1:-1]
session_number = int(sys.argv[2][:-1])
print(project_code, session_number)

# df_name = 'trials_response_df'
# conditions = ['cell_specimen_id', 'go', 'hit', 'image_name']
# conditions = ['cell_specimen_id', 'change', 'image_name', 'epoch']
df_name = 'trials_licks_df'
conditions = ['trials_id', 'go', 'hit']

df = io.get_multi_session_df(project_code, session_number, df_name, conditions, use_events=False, use_extended_stimulus_presentations=True)
print('done')

df_name = 'trials_pupil_area_df'
conditions = ['cell_specimen_id', 'go', 'hit', 'image_name']
# conditions = ['ophys_experiment_id', 'change', 'image_name', 'licked', 'hit_bout']
df_name = 'omission_licks_df'
conditions = ['stimulus_presentations_id']

df = io.get_multi_session_df(project_code, session_number, df_name, conditions, use_events=True, use_extended_stimulus_presentations=True)
print('done')
df = io.get_multi_session_df(project_code, session_number, df_name, conditions, use_events=False,
use_extended_stimulus_presentations=True)
print('done')
33 changes: 33 additions & 0 deletions scripts/generate_timeseries_plots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python

import os
import numpy as np
import pandas as pd
import visual_behavior.data_access.loading as loading
from visual_behavior.visualization.ophys import timeseries_figures as tf


if __name__ == '__main__':
import sys
experiment_id = sys.argv[1]

dataset = loading.get_ophys_dataset(experiment_id)
experiments_table = loading.get_filtered_ophys_experiment_table()
ophys_session_id = experiments_table.loc[int(experiment_id)].ophys_session_id

xlim_seconds = [400, 450]
tf.plot_behavior_and_pop_avg(dataset, xlim_seconds, save_figure=True)
xlim_seconds = [500, 600]
tf.plot_behavior_and_cell_traces_pop_avg(dataset, xlim_seconds, save_figure=True)
tf.plot_behavior_and_pop_avg_mesoscope(ophys_session_id, xlim_seconds=xlim_seconds, save_figure=True)

xlim_seconds = [3400, 3450]
tf.plot_behavior_and_pop_avg(dataset, xlim_seconds, save_figure=True)
xlim_seconds = [3500, 3600]
tf.plot_behavior_and_cell_traces_pop_avg(dataset, xlim_seconds, save_figure=True)
tf.plot_behavior_and_pop_avg_mesoscope(ophys_session_id, xlim_seconds=xlim_seconds, save_figure=True)

xlim_seconds = None
tf.plot_behavior_and_pop_avg(dataset, xlim_seconds, save_figure=True)
tf.plot_behavior_and_cell_traces_pop_avg(dataset, xlim_seconds, save_figure=True)
tf.plot_behavior_and_pop_avg_mesoscope(ophys_session_id, xlim_seconds=None, save_figure=True)
4 changes: 2 additions & 2 deletions scripts/run_create_multi_session_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if platform.system() == 'Linux':
# sys.path.append('/allen/programs/braintv/workgroups/nc-ophys/Doug/pbstools')
sys.path.append('/allen/programs/braintv/workgroups/nc-ophys/nick.ponvert/src/pbstools')
from pbstools import PythonJob # flake8: noqa: E999
from pbstools import PythonJob # flake8: noqa: E999


import visual_behavior.data_access.loading as loading
Expand All @@ -30,6 +30,6 @@
python_executable='/home/marinag/anaconda2/envs/visual_behavior_sdk/bin/python',
python_args=[project_code, session_number],
conda_env=None,
jobname='multi_session_df_'+project_code+'_'+str(session_number),
jobname='multi_session_df_' + project_code + '_' + str(session_number),
**job_settings
).run(dryrun=False)
33 changes: 33 additions & 0 deletions scripts/run_generate_timeseries_plots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os
import sys
import platform
if platform.system() == 'Linux':
# sys.path.append('/allen/programs/braintv/workgroups/nc-ophys/Doug/pbstools')
sys.path.append('/allen/programs/braintv/workgroups/nc-ophys/nick.ponvert/src/pbstools')
from pbstools import PythonJob # flake8: noqa: E999


import visual_behavior.data_access.loading as loading
experiments_table = loading.get_filtered_ophys_experiment_table()
experiment_ids = experiments_table.index.values

python_file = r"/home/marinag/visual_behavior_analysis/scripts/generate_timeseries_plots.py"

jobdir = '/allen/programs/braintv/workgroups/nc-ophys/Marina/ClusterJobs/JobRecords2'

job_settings = {'queue': 'braintv',
'mem': '40g',
'walltime': '10:00:00',
'ppn': 1,
'jobdir': jobdir,
}

for experiment_id in experiment_ids:
PythonJob(
python_file,
python_executable='/home/marinag/anaconda2/envs/visual_behavior_sdk/bin/python',
python_args=experiment_id,
conda_env=None,
jobname='process_{}'.format(experiment_id),
**job_settings
).run(dryrun=False)
22 changes: 11 additions & 11 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = visual-behavior
version = 0.10.0
version = 0.12.0
description = "analysis package for visual behavior"
authors = ["Marina Garrett", "Doug Ollerenshaw"]
author_email="[email protected], [email protected]",
Expand All @@ -9,15 +9,15 @@ url = "https://github.com/AllenInstitute/visual_behavior_analysis"
[options]
packages=find:
install_requires =
allensdk==2.8.0
scikit-learn==0.20.4
python-dateutil>=2.6.1
zipfile36
pymongo
pyyaml
opencv-python
dash
plotly
allensdk==2.10.2
scikit-learn==0.20.4
python-dateutil>=2.6.1
zipfile36
pymongo
pyyaml
opencv-python
dash
plotly

[options.extras_require]
DEV =
Expand All @@ -29,7 +29,7 @@ DEV =
coverage

[bumpversion]
current_version = 0.8.1.dev0
current_version = 0.13.0
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<n>\d+))?
Expand Down
2 changes: 2 additions & 0 deletions tests/data_access/test_loading.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import pytest

def test_basic_import():
from visual_behavior.data_access import loading

@pytest.mark.onprem
def test_get_filtered_ophys_session_table():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_find_nearest_index():

@pytest.mark.skipif(not os.path.exists('//allen/programs/braintv'), reason="no access to network path, skipping test on network PKL files")
def test_movie_load():
movie_path = "/allen/programs/braintv/workgroups/nc-ophys/visual_behavior/test_fixtures/853773937_video-0.avi"
movie_path = "//allen/programs/braintv/workgroups/nc-ophys/visual_behavior/test_fixtures/853773937_video-0.avi"
movie = Movie(movie_path)

# get frame by timestamp
Expand Down
Empty file.
39 changes: 0 additions & 39 deletions tests/translator/allensdk_sessions/conftest.py

This file was deleted.

113 changes: 0 additions & 113 deletions tests/translator/allensdk_sessions/test_allendk_session_translation.py

This file was deleted.

3 changes: 2 additions & 1 deletion visual_behavior/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__version__ = "0.10.0"

__version__ = "0.13.0"
Loading

0 comments on commit 4776e83

Please sign in to comment.