Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wela
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
wela
Commits
c346d4bd
Commit
c346d4bd
authored
7 months ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
fix(sample_traps_with_cells): fixed sampling
Bug in sampling was selecting empty traps.
parent
159eeaac
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/wela/imageviewer.py
+6
-6
6 additions, 6 deletions
src/wela/imageviewer.py
with
6 additions
and
6 deletions
src/wela/imageviewer.py
+
6
−
6
View file @
c346d4bd
...
@@ -79,8 +79,9 @@ class ImageViewer:
...
@@ -79,8 +79,9 @@ class ImageViewer:
if
tpt
in
cells
.
nonempty_tp_in_trap
(
trap_id
):
if
tpt
in
cells
.
nonempty_tp_in_trap
(
trap_id
):
traps_with_cells
.
append
(
trap_id
)
traps_with_cells
.
append
(
trap_id
)
break
break
traps_with_cells
=
np
.
unique
(
traps_with_cells
)
if
display
:
if
display
:
print
(
f
"
Traps with cells
{
traps_with_cells
}
"
)
print
(
f
"
Traps with cells
{
list
(
traps_with_cells
)
}
"
)
return
traps_with_cells
return
traps_with_cells
def
sample_traps_with_cells
(
self
,
no_cells
,
tpt_end
,
tpt_start
=
0
):
def
sample_traps_with_cells
(
self
,
no_cells
,
tpt_end
,
tpt_start
=
0
):
...
@@ -88,11 +89,10 @@ class ImageViewer:
...
@@ -88,11 +89,10 @@ class ImageViewer:
traps_with_cells
=
self
.
get_all_traps_with_cells
(
traps_with_cells
=
self
.
get_all_traps_with_cells
(
tpt_end
,
tpt_start
,
display
=
False
tpt_end
,
tpt_start
,
display
=
False
)
)
rng
=
np
.
random
.
default_rng
()
samples
=
np
.
random
.
choice
(
samples
=
rng
.
integers
(
traps_with_cells
,
low
=
0
,
size
=
np
.
min
([
no_cells
,
traps_with_cells
.
size
]),
high
=
len
(
traps_with_cells
),
replace
=
False
,
size
=
np
.
min
([
no_cells
,
len
(
traps_with_cells
)]),
)
)
return
samples
return
samples
...
...
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