Skip to content

Commit

Permalink
Merge pull request #2354 from PrincetonUniversity/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
kmantel authored Apr 1, 2022
2 parents aeddf3e + 98f353b commit 7072684
Show file tree
Hide file tree
Showing 174 changed files with 21,594 additions and 13,588 deletions.
3 changes: 2 additions & 1 deletion .github/actions/install-pnl/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
run: |
case "$RUNNER_OS" in
macOS*) brew install graphviz ;;
Linux*) sudo apt-get install -y graphviz ;;
Linux*) sudo apt-get update && sudo apt-get install -y --no-install-recommends graphviz ;;
Windows*) choco install --no-progress -y graphviz --version=2.38.0.20190211 ;;
*) echo "Unsupported OS"; exit 1 ;;
esac
Expand All @@ -42,6 +42,7 @@ runs:
run: |
if [ $(python -c 'import struct; print(struct.calcsize("P") * 8)') == 32 ]; then
sed -i /torch/d requirements.txt
sed -i /modeci_mdf/d requirements.txt
# pywinpty is a transitive dependency and v1.0+ removed support for x86 wheels
# terminado >= 0.10.0 pulls in pywinpty >= 1.1.0
[[ ${{ runner.os }} = Windows* ]] && pip install "pywinpty<1" "terminado<0.10"
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/pnl-ci-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,24 @@ jobs:
on_master: ${{ steps.on_master.outputs.on-branch }}

steps:
# increased fetch-depth and tag checkout needed as in pnl-ci.yml
- name: Checkout sources
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3
if: ${{ matrix.pnl-version == 'head' }}
with:
fetch-depth: 10
fetch-depth: 200
ref: ${{ github.ref }}

- name: Checkout pull base
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3
if: ${{ matrix.pnl-version == 'base' }}
with:
fetch-depth: 10
fetch-depth: 200
ref: ${{ github.base_ref }}

- name: Checkout tags
run: git fetch --tags origin master

- name: Check if on master
if: ${{ github.event_name == 'push' }}
id: on_master
Expand All @@ -61,7 +65,7 @@ jobs:
branch: master

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.3.1
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-architecture }}
Expand All @@ -75,7 +79,7 @@ jobs:
echo ::set-output name=pip_cache_dir::$(python -m pip cache dir)
- name: Wheels cache
uses: actions/cache@v2.1.7
uses: actions/cache@v3
with:
path: ${{ steps.pip_cache.outputs.pip_cache_dir }}/wheels
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2-${{ github.sha }}
Expand Down Expand Up @@ -103,7 +107,7 @@ jobs:
run: git tag -d 'v999.999.999.999'

- name: Upload Documentation
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v3
with:
name: Documentation-${{matrix.pnl-version}}-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.python-architecture }}
retention-days: 1
Expand All @@ -115,7 +119,7 @@ jobs:

- name: Upload PR number for other workflows
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v3
with:
name: pr_number
path: ./pr_number.txt
Expand All @@ -142,7 +146,7 @@ jobs:

steps:
- name: Checkout docs
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3
with:
ref: gh-pages

Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/pnl-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,21 @@ jobs:
os: macos-latest

steps:
# increased fetch-depth and tag checkout needed to get correct
# version string from versioneer (must have history to a prior tag);
# otherwise install fails due to circular dependency with modeci_mdf
- name: Checkout sources
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3
with:
fetch-depth: 10
fetch-depth: 200

# fetch only master to avoid getting unneeded branches with
# characters invalid on windows
- name: Checkout tags
run: git fetch --tags origin master

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.3.1
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-architecture }}
Expand All @@ -60,7 +68,7 @@ jobs:
echo ::set-output name=pip_cache_dir::$(python -m pip cache dir)
- name: Wheels cache
uses: actions/cache@v2.1.7
uses: actions/cache@v3
with:
path: ${{ steps.pip_cache.outputs.pip_cache_dir }}/wheels
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2-${{ github.sha }}
Expand All @@ -85,7 +93,7 @@ jobs:
run: pytest --junit-xml=tests_out.xml --verbosity=0 -n auto ${{ matrix.extra-args }}

- name: Upload test results
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.python-architecture }}-${{ matrix.extra-args }}
path: tests_out.xml
Expand All @@ -111,7 +119,7 @@ jobs:
python setup.py sdist bdist_wheel
- name: Upload dist packages
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v3
with:
name: dist-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.python-architecture }}
path: dist/
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
wheel: ${{ steps.create_dist.outputs.wheel }}
steps:
- name: Checkout sources
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.3.1
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -38,7 +38,7 @@ jobs:
echo ::set-output name=wheel::$(ls *.whl)
- name: Upload Python dist files
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v3
with:
name: Python-dist-files
path: dist/
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
path: dist/

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.3.1
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
run: pip install dist/${{ needs.create-python-dist.outputs.sdist }}[dev]

- name: Get tests from the repository
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3

- name: Run tests
shell: bash
Expand All @@ -126,7 +126,7 @@ jobs:
pytest --junit-xml=tests_out.xml --verbosity=0 -n auto tests
- name: Upload test results
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.os }}-${{ matrix.python-version }}
path: tests_out.xml
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@

# Created by https://www.gitignore.io/api/osx,python,pycharm

# Ignore JSON files created in tests/json/
# Maybe these should be generated in tmpdir instead
tests/json/*.json

# Log files created by SLURM jobs in this directory
Scripts/Debug/predator_prey_opt/logs/

# Any plots generated from testing DDMs
Scripts/Debug/ddm/*.png

### OSX ###
*.DS_Store
.AppleDouble
Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
.. image:: https://mybinder.org/badge.svg
:target: https://mybinder.org/v2/gh/PrincetonUniversity/PsyNeuLink/master

.. *****************************************************************************************
.. ****** NOTE: UPDATES TO THIS PAGE SHOULD ALSO BE MADE TO docs/source.index.rst *********
.. *****************************************************************************************
Welcome to PsyNeuLink
=====================
Expand Down
6 changes: 3 additions & 3 deletions Scripts/Debug/Jason_Reward_rate_with_penalty_with_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def get_stroop_model(unit_noise_std=.01, dec_noise_std=.1):
function=pnl.DriftDiffusionAnalytical(drift_rate=1,
threshold =1,
noise=1,
starting_point=0,
t0=0.35),
starting_value=0,
non_decision_time=0.35),
output_ports=[pnl.RESPONSE_TIME,
pnl.PROBABILITY_UPPER_THRESHOLD,
pnl.PROBABILITY_LOWER_THRESHOLD]
Expand Down Expand Up @@ -204,7 +204,7 @@ def get_stroop_model(unit_noise_std=.01, dec_noise_std=.1):
inp_task.input_port,
reward.input_port,
punish.input_port],
state_feature_functions=pnl.AdaptiveIntegrator(rate=0.1),
state_feature_function=pnl.AdaptiveIntegrator(rate=0.1),
objective_mechanism=objective_mech,
function=pnl.GridSearch(),
control_signals=[driftrate_control_signal,
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Debug/Predator-Prey Sebastian REDUCED.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get_new_episode_flag():

ocm = OptimizationControlMechanism(name='EVC',
state_features=[trial_type_input_mech],
# state_feature_functions=FEATURE_FUNCTION,
# state_feature_function=FEATURE_FUNCTION,
agent_rep=RegressionCFA(
name='RegressionCFA',
update_weights=BayesGLM(mu_0=0.5, sigma_0=0.1),
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Debug/Predator-Prey Sebastian.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def get_action(variable=[[0,0],[0,0],[0,0]]):

ocm = OptimizationControlMechanism(name='EVC',
state_features=[trial_type_input_mech],
# state_feature_functions=FEATURE_FUNCTION,
# state_feature_function=FEATURE_FUNCTION,
agent_rep=RegressionCFA(
name='RegressionCFA',
update_weights=BayesGLM(mu_0=0.5, sigma_0=0.1),
Expand Down
6 changes: 3 additions & 3 deletions Scripts/Debug/StabilityFlexibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def computeAccuracy(variable):
gain = np.asarray([[g]])

DRIFT = 1 # Drift Rate
STARTING_POINT = 0.0 # Starting Point
STARTING_VALUE = 0.0 # Starting Point
THRESHOLD = 0.0475 # Threshold
NOISE = 0.04 # Noise
T0 = 0.2 # T0
Expand Down Expand Up @@ -123,10 +123,10 @@ def computeAccuracy(variable):
ddmCombination.set_log_conditions([pnl.RESULT])

decisionMaker = pnl.DDM(function=pnl.DriftDiffusionAnalytical(drift_rate = DRIFT,
starting_point = STARTING_POINT,
starting_value = STARTING_VALUE,
threshold = THRESHOLD,
noise = NOISE,
t0 = T0),
non_decision_time = T0),
output_ports = [pnl.DECISION_VARIABLE, pnl.RESPONSE_TIME,
pnl.PROBABILITY_UPPER_THRESHOLD, pnl.PROBABILITY_LOWER_THRESHOLD],
name='DDM')
Expand Down
10 changes: 5 additions & 5 deletions Scripts/Debug/Umemoto_Feb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


# EVC params for Umemoto et al
t0 = 0.2
non_decision_time = 0.2
c = 0.19
thresh = 0.21
x_0 = 0 # starting point
Expand Down Expand Up @@ -59,8 +59,8 @@
# drift_rate=(0.1170),
threshold=(thresh),
noise=(c),
starting_point=(x_0),
t0=t0
starting_value=(x_0),
non_decision_time=non_decision_time
),name='Decision',
output_ports=[
pnl.DECISION_VARIABLE,
Expand All @@ -71,7 +71,7 @@
pnl.VARIABLE: (pnl.OWNER_VALUE, 2),
pnl.FUNCTION: pnl.Linear(0, slope=1.0, intercept=1)
}
],) #drift_rate=(1.0),threshold=(0.2645),noise=(0.5),starting_point=(0), t0=0.15
],) #drift_rate=(1.0),threshold=(0.2645),noise=(0.5),non_decision_time=(0), non_decision_time=0.15

Decision.set_log_conditions('InputPort-0')#, log_condition=pnl.PROCESSING)

Expand Down Expand Up @@ -120,7 +120,7 @@

Umemoto_comp.add_model_based_optimizer(optimizer=pnl.OptimizationControlMechanism(agent_rep=Umemoto_comp,
state_features=[Target_Stim.input_port, Distractor_Stim.input_port, Reward.input_port],
state_feature_functions=pnl.AdaptiveIntegrator(rate=1.0),
state_feature_function=pnl.AdaptiveIntegrator(rate=1.0),
objective_mechanism=pnl.ObjectiveMechanism(monitor_for_control=[Reward,
(Decision.output_ports[pnl.PROBABILITY_UPPER_THRESHOLD], 1, -1)],
),
Expand Down
10 changes: 5 additions & 5 deletions Scripts/Debug/Umemoto_Feb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


# EVC params for Umemoto et al
t0 = 0.2
non_decision_time = 0.2
c = 0.19
thresh = 0.21
x_0 = 0 # starting point
Expand Down Expand Up @@ -61,8 +61,8 @@
# drift_rate=(0.1170),
threshold=(thresh),
noise=(c),
starting_point=(x_0),
t0=t0
starting_value=(x_0),
non_decision_time=non_decision_time
),name='Decision',
output_ports=[
pnl.DECISION_VARIABLE,
Expand All @@ -73,7 +73,7 @@
pnl.VARIABLE: (pnl.OWNER_VALUE, 2),
pnl.FUNCTION: pnl.Linear(0, slope=1.0, intercept=1)
}
],) #drift_rate=(1.0),threshold=(0.2645),noise=(0.5),starting_point=(0), t0=0.15
],) #drift_rate=(1.0),threshold=(0.2645),noise=(0.5),non_decision_time=(0), non_decision_time=0.15

Decision.set_log_conditions('InputPort-0')#, log_condition=pnl.PROCESSING)
Decision.set_log_conditions('PROBABILITY_UPPER_THRESHOLD')
Expand Down Expand Up @@ -132,7 +132,7 @@
state_features=[Target_Stim.input_port,
Distractor_Stim.input_port,
Reward.input_port],
state_feature_functions=pnl.AdaptiveIntegrator(rate=1.0),
state_feature_function=pnl.AdaptiveIntegrator(rate=1.0),
objective_mechanism=pnl.ObjectiveMechanism(
monitor_for_control=[Reward,
(Decision.output_ports[pnl.PROBABILITY_UPPER_THRESHOLD], 1, -1)],
Expand Down
Empty file added Scripts/Debug/ddm/__init__.py
Empty file.
Loading

0 comments on commit 7072684

Please sign in to comment.