Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 1e0275e

Browse files
committed
rm workflow
2 parents dc7cf86 + 890507f commit 1e0275e

26 files changed

+2082
-860
lines changed

.coveragerc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[run]
2-
omit = */tests/*
2+
omit = */tests/*,bluepyopt/_version.py
3+
[report]
4+
omit=bluepyopt/_version.py

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- '[0-9]+.[0-9]+.[0-9]+'
9+
10+
jobs:
11+
call-test-workflow:
12+
uses: BlueBrain/BluePyOpt/.github/workflows/test.yml@master
13+
14+
build-n-publish:
15+
name: Build and publish on PyPI
16+
runs-on: ubuntu-latest
17+
needs: call-test-workflow
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up Python 3.6
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: 3.6
27+
28+
- name: Build a source tarball and wheel
29+
run: |
30+
pip install wheel
31+
python setup.py sdist bdist_wheel
32+
33+
- name: Publish package to PyPI
34+
uses: pypa/gh-action-pypi-publish@master
35+
with:
36+
user: __token__
37+
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/keep-alive.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Keep-alive
2+
3+
on:
4+
schedule:
5+
# Runs every sunday at 3 a.m.
6+
- cron: '0 3 * * SUN'
7+
8+
jobs:
9+
call-test-workflow:
10+
uses: BlueBrain/BluePyOpt/.github/workflows/test.yml@master
11+
12+
keep-workflow-alive:
13+
name: Keep workflow alive
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
ref: master
19+
20+
- name: Get date from 50 days ago
21+
run: |
22+
datethen=`date -d "-50 days" --utc +%FT%TZ`
23+
echo "datelimit=$datethen" >> $GITHUB_ENV
24+
25+
- name: setup git config
26+
if: github.event.base.repo.updated_at <= env.datelimit
27+
run: |
28+
# setup the username and email.
29+
git config user.name "Github Actions Keepalive Bot"
30+
git config user.email "<>"
31+
32+
- name: commit IF last commit is older than 50 days
33+
if: github.event.base.repo.updated_at <= env.datelimit
34+
run: |
35+
git commit -m "Empty commit to keep the gihub workflows alive" --allow-empty
36+
git push origin master

.github/workflows/main.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
# allows this workflow to be reusable (e.g. by the build workflow)
6+
workflow_call:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip setuptools
26+
pip install tox tox-gh-actions
27+
28+
- name: Run tox
29+
run: tox
30+
31+
- name: "Upload coverage to Codecov"
32+
uses: codecov/codecov-action@v2
33+
with:
34+
token: ${{ secrets.CODECOV_TOKEN }}
35+
fail_ci_if_error: false

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ When you use the BluePyOpt software or method for your research, we ask you to c
9797
}
9898
9999
100+
Publications that use or mention BluePyOpt
101+
==========================================
102+
The list of publications that use or mention BluePyOpt can be found on `the github wiki page <https://github.com/BlueBrain/BluePyOpt/wiki/Publications-that-use-or-mention-BluePyOpt>`_.
103+
100104
Support
101105
=======
102106
We are providing support using a chat channel on `Gitter <https://gitter.im/BlueBrain/BluePyOpt>`_, or the `Github discussion page <https://github.com/BlueBrain/BluePyOpt/discussions>`_.

bluepyopt/deapext/CMA_MO.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def get_hyped(pop, ubound_score=250., threshold_improvement=240.):
7171
ubounds = numpy.max(points, axis=0) + 2.0
7272

7373
hv = hype.hypeIndicatorSampled(
74-
points=points, bounds=ubounds, k=5, nrOfSamples=200000
74+
points=points, bounds=ubounds, k=5, nrOfSamples=1000000
7575
)
7676
return hv
7777

bluepyopt/ephys/locations.py

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
from bluepyopt.ephys.base import BaseEPhys
2727
from bluepyopt.ephys.serializer import DictMixin
28+
import numpy as np
2829

2930

3031
class Location(BaseEPhys):
@@ -354,7 +355,7 @@ def __init__(
354355
name,
355356
soma_distance=soma_distance,
356357
seclist_name=sec_name,
357-
comment=''
358+
comment=comment,
358359
)
359360
self.sec_index = sec_index
360361

@@ -392,6 +393,74 @@ def instantiate(self, sim=None, icell=None):
392393
return self.find_icomp(sim, branches)
393394

394395

396+
class NrnTrunkSomaDistanceCompLocation(NrnSecSomaDistanceCompLocation):
397+
"""Location at a distance from soma along a main direction.
398+
399+
We search for the section that is the furthest away from some along
400+
a direction, and pick a location at a given distance from soma along
401+
the path to that section.
402+
403+
If direction == 'radial', the largest radial direction is used.
404+
405+
This is most useful to follow the trunk of an apical dendrite
406+
without knowing the apical point, but only that apical trunk goes along y.
407+
"""
408+
409+
def __init__(
410+
self,
411+
name,
412+
soma_distance=None,
413+
sec_index=None,
414+
sec_name=None,
415+
direction=None,
416+
comment=""
417+
):
418+
"""Constructor
419+
420+
Args:
421+
name (str): name of this object
422+
soma_distance (float): distance from soma to this compartment
423+
sec_index (int): index of the section to consider
424+
sec_name (str): name of Neuron sections (ex: 'apic')
425+
direction (list of 3 elements): 3d vector representing direction,
426+
if None, default is [0, 1, 0]
427+
"""
428+
super(NrnTrunkSomaDistanceCompLocation, self).__init__(
429+
name,
430+
soma_distance=soma_distance,
431+
sec_index=sec_index,
432+
sec_name=sec_name,
433+
comment=comment
434+
)
435+
436+
if direction is None:
437+
direction = [0.0, 1.0, 0.0]
438+
self.direction = direction
439+
440+
def set_sec_index(self, icell=None):
441+
"""Search for the point furthest away along given direction."""
442+
points = np.array(
443+
[
444+
[
445+
section.x3d(section.n3d() - 1),
446+
section.y3d(section.n3d() - 1),
447+
section.z3d(section.n3d() - 1),
448+
]
449+
for section in getattr(icell, self.seclist_name)
450+
]
451+
)
452+
if self.direction == 'radial':
453+
self.sec_index = int(np.argmax(np.linalg.norm(points, axis=1)))
454+
else:
455+
self.sec_index = int(np.argmax(points.dot(self.direction)))
456+
457+
def instantiate(self, sim=None, icell=None):
458+
""" """
459+
if self.sec_index is None:
460+
self.set_sec_index(icell=icell)
461+
return super().instantiate(sim=sim, icell=icell)
462+
463+
395464
class EPhysLocInstantiateException(Exception):
396465

397466
"""All exception generated by location instantiation"""

bluepyopt/ephys/mechanisms.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,19 @@ def instantiate_determinism(self, deterministic, icell, isec, sim):
123123
(self.suffix),
124124
1 if deterministic else 0)
125125

126-
if not deterministic:
127-
# Set the seeds
128-
short_secname = sim.neuron.h.secname(sec=isec).split('.')[-1]
129-
for iseg in isec:
130-
seg_name = '%s.%.19g' % (short_secname, iseg.x)
131-
getattr(sim.neuron.h,
132-
"setdata_%s" % self.suffix)(iseg.x, sec=isec)
133-
seed_id1 = icell.gid
134-
seed_id2 = self.hash_py(seg_name)
135-
getattr(
136-
sim.neuron.h,
137-
"setRNG_%s" % self.suffix)(seed_id1, seed_id2)
126+
# Set the seeds even when deterministic,
127+
# that way neuron's psection does not crash
128+
# when encountering a stoch mech var that is not set (e.g. rng)
129+
short_secname = sim.neuron.h.secname(sec=isec).split('.')[-1]
130+
for iseg in isec:
131+
seg_name = '%s.%.19g' % (short_secname, iseg.x)
132+
getattr(sim.neuron.h,
133+
"setdata_%s" % self.suffix)(iseg.x, sec=isec)
134+
seed_id1 = icell.gid
135+
seed_id2 = self.hash_py(seg_name)
136+
getattr(
137+
sim.neuron.h,
138+
"setRNG_%s" % self.suffix)(seed_id1, seed_id2)
138139
else:
139140
if not deterministic:
140141
# can't do this for non-Stoch channels

0 commit comments

Comments
 (0)