Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alibylite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Swain Lab
aliby
alibylite
Commits
a9d87bf2
Commit
a9d87bf2
authored
3 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
add docs and limit all automatic function fetching
parent
9f7a8c5c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extraction/core/functions/loaders.py
+31
-3
31 additions, 3 deletions
extraction/core/functions/loaders.py
with
31 additions
and
3 deletions
extraction/core/functions/loaders.py
+
31
−
3
View file @
a9d87bf2
...
...
@@ -17,9 +17,14 @@ def load_cellfuns_core():
def
load_custom_args
():
"""
Load custom functions. If they have extra arguments also load these
Load custom functions. If they have extra arguments (starting at index 2,
after mask and image) also load these.
"""
funs
=
{
f
[
0
]:
f
[
1
]
for
f
in
getmembers
(
localisation
)
if
isfunction
(
f
[
1
])}
funs
=
{
f
[
0
]:
f
[
1
]
for
f
in
getmembers
(
localisation
)
if
isfunction
(
f
[
1
])
and
f
[
1
].
__module__
.
startswith
(
"
extraction.core.functions
"
)
}
args
=
{
k
:
getargspec
(
v
).
args
[
2
:]
for
k
,
v
in
funs
.
items
()
...
...
@@ -30,6 +35,12 @@ def load_custom_args():
def
load_cellfuns
():
"""
Input:
Returns:
Dict(str, function)
"""
# Generate str -> trap_function dict from core.cell and core.trap functions
cell_funs
=
load_cellfuns_core
()
CELLFUNS
=
{}
...
...
@@ -44,11 +55,22 @@ def load_cellfuns():
def
load_trapfuns
():
TRAPFUNS
=
{
f
[
0
]:
f
[
1
]
for
f
in
getmembers
(
trap
)
if
isfunction
(
f
[
1
])}
"""
Load functions that are applied to an entire trap (or tile, or subsection of a given image),
instead of being applied to single cells.
"""
TRAPFUNS
=
{
f
[
0
]:
f
[
1
]
for
f
in
getmembers
(
trap
)
if
isfunction
(
f
[
1
])
and
f
[
1
].
__module__
.
startswith
(
"
extraction.core.functions
"
)
}
return
TRAPFUNS
def
load_funs
():
"""
Combine all automatically-loaded functions
"""
CELLFUNS
=
load_cellfuns
()
TRAPFUNS
=
load_trapfuns
()
...
...
@@ -56,6 +78,9 @@ def load_funs():
def
load_redfuns
():
# TODO make defining reduction functions more flexible
"""
Load z-stack reduction functions.
"""
RED_FUNS
=
{
"
np_max
"
:
np
.
maximum
,
"
np_mean
"
:
np
.
mean
,
...
...
@@ -66,5 +91,8 @@ def load_redfuns(): # TODO make defining reduction functions more flexible
def
load_mergefuns
():
"""
Load functions to merge multiple channels
"""
MERGE_FUNS
=
{
"
div0
"
:
div0
,
"
np_add
"
:
np
.
add
}
return
MERGE_FUNS
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment