soft-matter / pims_nd2

Python nd2 reader based on the ND2 SDK
Other
16 stars 8 forks source link

Added LoadLibrary lines for OS X & updated ND2SDK libraries. #12

Closed stevendbrown closed 8 years ago

stevendbrown commented 8 years ago

Added LoadLibrary lines for OS X & updated ND2SDK libraries. I hope this is a better-formed PR.

caspervdw commented 8 years ago

Great! I like the timestart_jdn addition. There is something fishy with line-endings going on, but I don't think it will hurt.

caspervdw commented 8 years ago

Looks good. Could you try and run test.py on OSX? That would confirm the full functionality.

stevendbrown commented 8 years ago

Something may be awry:

======================================================================
ERROR: test_metadata (__main__.TestND2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test.py", line 140, in test_metadata
    assert_equal(self.v.metadata['z_home'], 4)
KeyError: u'z_home'

======================================================================
ERROR: test_time (__main__.TestND2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test.py", line 146, in test_time
    time = self.v.metadata['time_start_utc']
KeyError: u'time_start_utc'

----------------------------------------------------------------------
Ran 19 tests in 0.053s

FAILED (errors=2)

I will look into the errors.

caspervdw commented 8 years ago

I'm guessing that you tested against the wrong version: time_start_utc and z_home are relatively new additions.

stevendbrown commented 8 years ago

Yep, you were right. With the branch version of pims_nd2 loaded in ipython before run -i ./test.py:

In [1]: import os, sys

In [2]: sys.path.insert(1, '/Users/sdbrown/pims_nd2')

In [3]: import pims_nd2

In [4]: run -i ./test.py
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
test_bool (__main__.TestND2) ... ok
test_change_channel (__main__.TestND2) ... ok
test_count (__main__.TestND2) ... ok
test_frame_number_accurate (__main__.TestND2) ... ok
test_frame_number_present (__main__.TestND2) ... ok
test_getting_list (__main__.TestND2) ... ok
test_getting_single_frame (__main__.TestND2) ... ok
test_getting_slice (__main__.TestND2) ... ok
test_getting_stack (__main__.TestND2) ... ok
test_integer_attributes (__main__.TestND2) ... ok
test_iterator (__main__.TestND2) ... ok
test_metadata (__main__.TestND2) ... ok
test_metadata_framewise (__main__.TestND2) ... ok
test_repr (__main__.TestND2) ... ok
test_shape (__main__.TestND2) ... ok
test_simple_negative_index (__main__.TestND2) ... ok
test_sizeC (__main__.TestND2) ... ok
test_sizeZ (__main__.TestND2) ... ok
test_time (__main__.TestND2) ... ok

----------------------------------------------------------------------
Ran 19 tests in 0.050s

OK

It seems OK to me. I presume that adding a test for time_start_jdn would be out of place since it is directly read from the SDK rather than derived by pims_nd2...?

caspervdw commented 8 years ago

Great! I will go through it one more time and then merge. These linebreak changes are bothering me-I may make a new PR based on yours.

Btw, you can make a .pth file listing extra paths and put it in your site-packages folder, then python will also search these paths for packages.

stevendbrown commented 8 years ago

Do you mean the sort of line break changes in the github representations of symbolic links in the nd2sdk.framework folder? That may explain why I can't get the libraries to load without pointing to the non-symlink files in Version/1/, despite OS X following the symlinks correctly. Otherwise...please let me know what you deduce, I'd like to fix it on my end to avoid problems in the future.

caspervdw commented 8 years ago

I don't know how linebreaks would influence the symlinks on a mac, but I basically copied your edits to a new branch that hasn't the linebreak changes. I made the PR: #13, so I am closing this one.

If you want to checkout my new branch and try to remove Version/1/, that would be great.

Just make a new (local) branch based on current master and:

 git pull https://github.com/caspervdw/pims_nd2.git osx-implement