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

Inference bug, pandas docker version #153

Merged
merged 6 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
jennyfolkesson marked this conversation as resolved.
Show resolved Hide resolved
protobuf==3.20.1
pydot==1.4.1
PyYAML>=5.4
Expand Down
23 changes: 23 additions & 0 deletions tests/utils/aux_utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,29 @@ 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')
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')


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇
Great job adding tests! My only comment is that I would separate these into two tests, which makes it easier to spot exactly where the code breaks if a test isn't passing. But that's optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

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