Skip to content
This repository has been archived by the owner on Jul 29, 2023. It is now read-only.

Commit

Permalink
Inference bug, pandas docker version (#153)
Browse files Browse the repository at this point in the history
* fix channel_name bug

* set pandas to 0.24.2 in docker requirements

* add test & update docstring for aux_utils - get_sms_im_name function

Co-authored-by: Jenny Folkesson <[email protected]>
  • Loading branch information
JohannaRahm and jennyfolkesson authored Jun 17, 2022
1 parent d749d22 commit 7d5ab57
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
6 changes: 3 additions & 3 deletions micro_dl/utils/aux_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def get_sms_im_name(time_idx=None,
This function is custom for the computational microscopy (SMS)
group, who has the following file naming convention:
File naming convention is assumed to be:
img_channelname_t***_p***_z***.tif
img_channelname_t***_p***_z***_extrafield.tif
This function will alter list and dict in place.
:param int time_idx: Time index
Expand All @@ -194,11 +194,11 @@ def get_sms_im_name(time_idx=None,
:param str extra_field: Any extra string you want to include in the name
:param str ext: Extension, e.g. '.png'
:param int int2str_len: Length of string of the converted integers
:return st im_name: Image file name
:return str im_name: Image file name
"""

im_name = "img"
if np.isnan(channel_name):
if not pd.isnull(channel_name):
im_name += "_" + str(channel_name)
if time_idx is not None:
im_name += "_t" + str(time_idx).zfill(int2str_len)
Expand Down
2 changes: 1 addition & 1 deletion requirements_docker.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ natsort==6.0.0
nose==1.3.7
numpy==1.21.0
opencv-python==4.4.0.40
pandas==1.1.5
pandas==0.24.2
protobuf==3.20.1
pydot==1.4.1
PyYAML>=5.4
Expand Down
26 changes: 26 additions & 0 deletions tests/utils/aux_utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,32 @@ def test_get_im_name():
nose.tools.assert_equal(im_name, 'im_c2_z3_t1_p4_hej.png')


def test_get_sms_im_name():
im_name = aux_utils.get_sms_im_name(
time_idx=0,
channel_name='phase',
slice_idx=10,
pos_idx=100,
extra_field='blub',
ext='.png',
int2str_len=3,
)
nose.tools.assert_equal(im_name, 'img_phase_t000_p100_z010_blub.png')


def test_get_sms_im_name_nones():
im_name = aux_utils.get_sms_im_name(
time_idx=0,
channel_name=None,
slice_idx=None,
pos_idx=10,
extra_field=None,
ext='.jpg',
int2str_len=2,
)
nose.tools.assert_equal(im_name, 'img_t00_p10.jpg')


def test_get_im_name_default():
im_name = aux_utils.get_im_name()
nose.tools.assert_equal(im_name, 'im.png')
Expand Down

0 comments on commit 7d5ab57

Please sign in to comment.