igor.git
12 years agoFixes to string/byte handling for Python 3 compatibility.
W. Trevor King [Sat, 21 Jul 2012 13:54:20 +0000 (09:54 -0400)]
Fixes to string/byte handling for Python 3 compatibility.

I don't know if encoding information is embedded in the IGOR files or
not.  Currently the stock parser just leaves everything it reads in in
bytes.  For compatibility, the igorpy module attempts to convert those
byte strings to Unicode, but it just assumes that the encoding used in
the file matches the locale or default encoding used by your system.
This could be a portability issue.  Until commit

  commit fe7006e3e2d741b6d80767b1aac53394ff1e7e76
  Author: W. Trevor King <wking@tremily.us>
  Date:   Sat Jul 21 07:50:09 2012 -0400

    Replace igor.igorpy parsing with translations from igor.packed.load.

The igorpy parser used sys.getfilesystemencoding() to guess the
encoding, but that encoding is actually used to encode file names, not
file contents.  locale.getpreferredencoding is a better guess, but
it's still just a guess.

12 years agoConvert exception.message -> exception.args[0] for Python 3 compatibility.
W. Trevor King [Sat, 21 Jul 2012 13:48:09 +0000 (09:48 -0400)]
Convert exception.message -> exception.args[0] for Python 3 compatibility.

Python 3 exceptions no longer have a .message attribute.

12 years agoAdd W_plrX5.data_units check to test-igorpy.py.
W. Trevor King [Sat, 21 Jul 2012 13:37:52 +0000 (09:37 -0400)]
Add W_plrX5.data_units check to test-igorpy.py.

12 years agoUse integer division when calculating DynamicStringIndicesDataField count.
W. Trevor King [Sat, 21 Jul 2012 13:12:22 +0000 (09:12 -0400)]
Use integer division when calculating DynamicStringIndicesDataField count.

In Python 3, the floating point division lead to:

    Traceback (most recent call last):
      ...
      File ".../igor/struct.py", line 255, in unpack_data
        items = [next(iterator) for i in range(self.arg_count)]
    TypeError: 'numpy.float64' object cannot be interpreted as an integer

12 years agoConvert buffer(...) -> bytes(...) for Python 3 compatibility.
W. Trevor King [Sat, 21 Jul 2012 13:07:36 +0000 (09:07 -0400)]
Convert buffer(...) -> bytes(...) for Python 3 compatibility.

12 years agoAdd igor.util._ord for Python 3 compatibility.
W. Trevor King [Sat, 21 Jul 2012 13:04:18 +0000 (09:04 -0400)]
Add igor.util._ord for Python 3 compatibility.

12 years agoUse integer division in Field.indexes for Python 3 compatibility.
W. Trevor King [Sat, 21 Jul 2012 12:53:42 +0000 (08:53 -0400)]
Use integer division in Field.indexes for Python 3 compatibility.

12 years agoPython 3 scraps the iter(...).next() method, so use next(iter(...)).
W. Trevor King [Sat, 21 Jul 2012 12:48:00 +0000 (08:48 -0400)]
Python 3 scraps the iter(...).next() method, so use next(iter(...)).

12 years agoDon't use u'...' syntax in igor.igorpy.
W. Trevor King [Sat, 21 Jul 2012 12:42:10 +0000 (08:42 -0400)]
Don't use u'...' syntax in igor.igorpy.

This breaks Python 2 Unicode handling, but it allows igorpy to be used
in its raw form by Python 3.

12 years agoRemove struct._buffer because I don't use it anymore.
W. Trevor King [Sat, 21 Jul 2012 12:40:44 +0000 (08:40 -0400)]
Remove struct._buffer because I don't use it anymore.

12 years agoAdd update-copyright blurb to the README (+minor typo fixes).
W. Trevor King [Sat, 21 Jul 2012 12:33:01 +0000 (08:33 -0400)]
Add update-copyright blurb to the README (+minor typo fixes).

12 years agoRan update-copyright.py.
W. Trevor King [Sat, 21 Jul 2012 12:30:08 +0000 (08:30 -0400)]
Ran update-copyright.py.

12 years agoPull common script code into igor.script and add bin/igorpackedexperiment.py.
W. Trevor King [Sat, 21 Jul 2012 12:18:14 +0000 (08:18 -0400)]
Pull common script code into igor.script and add bin/igorpackedexperiment.py.

To avoid conflicts with the build-in `-v` `--version` argument, the
short form of `--verbose` is now `-V`.

12 years agoUse DebuggingStream for any LOG.level <= DEBUG (not just ==).
W. Trevor King [Sat, 21 Jul 2012 11:59:58 +0000 (07:59 -0400)]
Use DebuggingStream for any LOG.level <= DEBUG (not just ==).

12 years agoAvoid expensive pformating in DynamicStructure.unpack_stream unless required.
W. Trevor King [Sat, 21 Jul 2012 11:56:49 +0000 (07:56 -0400)]
Avoid expensive pformating in DynamicStructure.unpack_stream unless required.

If we're not going to be printing the formatted data in the log, don't
bother calculating it.  On my system, this speeds up the loading of
polar-graphs-demo.pxp by a factor of 10.

12 years agoReplace igor.igorpy parsing with translations from igor.packed.load.
W. Trevor King [Sat, 21 Jul 2012 11:50:09 +0000 (07:50 -0400)]
Replace igor.igorpy parsing with translations from igor.packed.load.

12 years agoAdd 'not enough data...' errors to packed.load().
W. Trevor King [Sat, 21 Jul 2012 11:48:54 +0000 (07:48 -0400)]
Add 'not enough data...' errors to packed.load().

12 years agoAdd test-igorpy.py for testing igor.igorpy.
W. Trevor King [Fri, 20 Jul 2012 20:05:18 +0000 (16:05 -0400)]
Add test-igorpy.py for testing igor.igorpy.

12 years agoUse LOG to print helpful messages in test.py.
W. Trevor King [Fri, 20 Jul 2012 20:03:28 +0000 (16:03 -0400)]
Use LOG to print helpful messages in test.py.

12 years agoPoint out that test/data is not bundled.
W. Trevor King [Fri, 20 Jul 2012 19:27:23 +0000 (15:27 -0400)]
Point out that test/data is not bundled.

12 years agoAdd COPYING file with GPLv3 text.
W. Trevor King [Fri, 20 Jul 2012 19:25:22 +0000 (15:25 -0400)]
Add COPYING file with GPLv3 text.

12 years agoUpdate igorbinarywave.py to use dynamic structure interface.
W. Trevor King [Fri, 20 Jul 2012 19:22:34 +0000 (15:22 -0400)]
Update igorbinarywave.py to use dynamic structure interface.

12 years agoInitial merge with igor.py, still need to integrate code.
W. Trevor King [Fri, 20 Jul 2012 19:15:42 +0000 (15:15 -0400)]
Initial merge with igor.py, still need to integrate code.

12 years agoRework igor.struct to support dynamic structures.
W. Trevor King [Fri, 20 Jul 2012 18:50:09 +0000 (14:50 -0400)]
Rework igor.struct to support dynamic structures.

Between binarywave and record.variables, there was a good deal of
parsing that was conditional on previously parsed data.  Rather than
continue writing spaghetti code to handle each specific case, I've
taken a stab at a general framework for updating structures during
parsing (DynamicStructure and DynamicField).  The docstrings should
explain how they work.  The implementation still has a few holes, but
it works on each of the files in my test suite.

12 years agoAdd igor.LOG for easier debugging.
W. Trevor King [Fri, 20 Jul 2012 18:46:08 +0000 (14:46 -0400)]
Add igor.LOG for easier debugging.

12 years agofix record.base
W. Trevor King [Thu, 19 Jul 2012 14:49:40 +0000 (10:49 -0400)]
fix record.base

12 years agoUse variable names to store variables in the filesystem (vs. VariablesRecord).
W. Trevor King [Thu, 19 Jul 2012 14:43:16 +0000 (10:43 -0400)]
Use variable names to store variables in the filesystem (vs. VariablesRecord).

12 years agoStore wave, bin_info, and wave_info separately in WaveRecord.
W. Trevor King [Thu, 19 Jul 2012 14:20:53 +0000 (10:20 -0400)]
Store wave, bin_info, and wave_info separately in WaveRecord.

This makes more sense than storing them as a tuple.

Also, use wave_record.wave_info['bname'] as the name for storing the
wave in the filesystem view returned by packed.load.

12 years agoRead sIndices as uint32's in binarywave.load.
W. Trevor King [Thu, 19 Jul 2012 13:56:47 +0000 (09:56 -0400)]
Read sIndices as uint32's in binarywave.load.

12 years agoImplement the folder records and filesystem reconstruction.
W. Trevor King [Thu, 19 Jul 2012 13:30:28 +0000 (09:30 -0400)]
Implement the folder records and filesystem reconstruction.

12 years agoImplement the plain-text ProcedureRecord.
W. Trevor King [Thu, 19 Jul 2012 12:33:14 +0000 (08:33 -0400)]
Implement the plain-text ProcedureRecord.

12 years agoImplement the plain-text HistoryRecord, RecreationRecord, and GetHistoryRecord.
W. Trevor King [Thu, 19 Jul 2012 12:31:11 +0000 (08:31 -0400)]
Implement the plain-text HistoryRecord, RecreationRecord, and GetHistoryRecord.

12 years agoSplit record handling into modules and implement VariablesRecord.
W. Trevor King [Thu, 19 Jul 2012 12:14:04 +0000 (08:14 -0400)]
Split record handling into modules and implement VariablesRecord.

12 years agostruct: Add support for zero-count Fields.
W. Trevor King [Wed, 18 Jul 2012 22:20:52 +0000 (18:20 -0400)]
struct: Add support for zero-count Fields.

12 years agoExtend igor.struct.Structure and .Field to support nesting.
W. Trevor King [Wed, 18 Jul 2012 20:34:05 +0000 (16:34 -0400)]
Extend igor.struct.Structure and .Field to support nesting.

12 years agoMove need_to_reorder_bytes from binarywave to util.
W. Trevor King [Tue, 17 Jul 2012 12:59:17 +0000 (08:59 -0400)]
Move need_to_reorder_bytes from binarywave to util.

We'll be needing it for packed.load, so it's not binarywave-specific.

12 years agoWaveRecord now loads waves as WaveRecord.wave.
W. Trevor King [Tue, 17 Jul 2012 12:00:03 +0000 (08:00 -0400)]
WaveRecord now loads waves as WaveRecord.wave.

12 years agoAPI cleanup for binarywave (loadibw->load, move checksum to util, ...).
W. Trevor King [Tue, 17 Jul 2012 11:49:06 +0000 (07:49 -0400)]
API cleanup for binarywave (loadibw->load, move checksum to util, ...).

Also moved byte_order to the util module and renamed a few functions
internal to the binarywave module so they start with an underscore.

The loadibw -> load (and saveibw -> save) change is because

  from igor.binarywave import load

gives you enough of an idea about what you're importing.  If you want
to keep it explicit in your client module, use

  from igor.binarywave import load as loadibw

which we do in the test.py module.

12 years agoStub out packed experiment (.pxp) reading.
W. Trevor King [Tue, 17 Jul 2012 11:32:33 +0000 (07:32 -0400)]
Stub out packed experiment (.pxp) reading.

12 years agoSplit struct and util modules out of binarywave.
W. Trevor King [Tue, 17 Jul 2012 03:23:47 +0000 (23:23 -0400)]
Split struct and util modules out of binarywave.

12 years agoAdd the test suite that's been driving today's changes.
W. Trevor King [Tue, 17 Jul 2012 03:02:11 +0000 (23:02 -0400)]
Add the test suite that's been driving today's changes.

Samples are from TN003.zip, downloaded from
  ftp://www.wavemetrics.net/IgorPro/Technical_Notes/TN003.zip

12 years agoPreliminary support for dependent formula waves.
W. Trevor King [Tue, 17 Jul 2012 03:01:18 +0000 (23:01 -0400)]
Preliminary support for dependent formula waves.

12 years agoAdd support for text waves.
W. Trevor King [Tue, 17 Jul 2012 02:40:10 +0000 (22:40 -0400)]
Add support for text waves.

I'm confident in the bytes -> strings conversion, but not entirely
sure how the strings get mapped into multidimensional arrays.

12 years agoAdd support for zero-length waves.
W. Trevor King [Tue, 17 Jul 2012 02:01:57 +0000 (22:01 -0400)]
Add support for zero-length waves.

12 years agoRestore native byte order before running need_to_reorder_bytes.
W. Trevor King [Mon, 16 Jul 2012 20:28:43 +0000 (16:28 -0400)]
Restore native byte order before running need_to_reorder_bytes.

Otherwise an earier switch to a non-native byte ordering will confuse
the current load.

12 years agoPull null-buffer check out into its own function: binarywave.assert_null.
W. Trevor King [Mon, 16 Jul 2012 19:51:14 +0000 (15:51 -0400)]
Pull null-buffer check out into its own function: binarywave.assert_null.

12 years agoUpgrade to Python 2.7+ string formatting.
W. Trevor King [Mon, 16 Jul 2012 19:17:03 +0000 (15:17 -0400)]
Upgrade to Python 2.7+ string formatting.

12 years agoSplit igorbinarywave.py off of Hooke into its own package.
W. Trevor King [Mon, 16 Jul 2012 18:56:43 +0000 (14:56 -0400)]
Split igorbinarywave.py off of Hooke into its own package.

12 years agoAdd -n/--not-strict to igorbinarywave.py (currently for IBW files with non-empty... v0.1
W. Trevor King [Thu, 28 Oct 2010 16:39:29 +0000 (12:39 -0400)]
Add -n/--not-strict to igorbinarywave.py (currently for IBW files with non-empty padding).

12 years agoMove hooke.driver.igorbinarywave to hooke.util.igorbinarywave.
W. Trevor King [Wed, 8 Sep 2010 14:30:28 +0000 (10:30 -0400)]
Move hooke.driver.igorbinarywave to hooke.util.igorbinarywave.

It's a utility for the MFP3D driver, not a driver in its own right.

12 years agoRan update_copyright.py
W. Trevor King [Tue, 3 Aug 2010 00:10:15 +0000 (20:10 -0400)]
Ran update_copyright.py

12 years agoAdded post-data optional field processing to igorbinarywave.loadibw.
W. Trevor King [Fri, 4 Jun 2010 07:28:19 +0000 (03:28 -0400)]
Added post-data optional field processing to igorbinarywave.loadibw.

12 years agoAutomatically split version 5 Igor wave files into columns
W. Trevor King [Fri, 4 Jun 2010 06:46:11 +0000 (02:46 -0400)]
Automatically split version 5 Igor wave files into columns

12 years agoRan update_copyright.py on igorbinarywave.py
W. Trevor King [Fri, 4 Jun 2010 05:16:51 +0000 (01:16 -0400)]
Ran update_copyright.py on igorbinarywave.py

12 years agoAdd hooke.driver.igorbinarywave so Hooke can read Igor files.
W. Trevor King [Fri, 4 Jun 2010 05:15:46 +0000 (01:15 -0400)]
Add hooke.driver.igorbinarywave so Hooke can read Igor files.

12 years agoSplit IGOR handling out into its own repository.
W. Trevor King [Mon, 16 Jul 2012 17:15:34 +0000 (13:15 -0400)]
Split IGOR handling out into its own repository.

13 years agofix doc typo
Paul Kienzle [Mon, 17 Oct 2011 18:47:34 +0000 (14:47 -0400)]
fix doc typo

13 years agoacknowledge patch author
Paul Kienzle [Sat, 15 Oct 2011 01:03:15 +0000 (21:03 -0400)]
acknowledge patch author

13 years agorelease notes
Paul Kienzle [Sat, 15 Oct 2011 00:59:55 +0000 (20:59 -0400)]
release notes

13 years agobump version number and push to pypi
Paul Kienzle [Sat, 15 Oct 2011 00:27:32 +0000 (20:27 -0400)]
bump version number and push to pypi

13 years agoUse IgorObject as base; make sure subfolder name is valid before using it as an attribute
Paul Kienzle [Sat, 15 Oct 2011 00:23:59 +0000 (20:23 -0400)]
Use IgorObject as base; make sure subfolder name is valid before using it as an attribute

13 years agoMerge branch 'master' of github.com:reflectometry/igor.py
Paul Kienzle [Fri, 14 Oct 2011 23:40:55 +0000 (19:40 -0400)]
Merge branch 'master' of github.com:reflectometry/igor.py

13 years agoMerge pull request #2 from valhallasw/master
pkienzle [Fri, 14 Oct 2011 23:41:49 +0000 (16:41 -0700)]
Merge pull request #2 from valhallasw/master

Several commits, including fix for issue 1 (fixes #1, fixes #2)

13 years ago(formatting) added extra newline
Merlijn van Deen (valhallasw) [Mon, 26 Sep 2011 08:43:00 +0000 (10:43 +0200)]
(formatting) added extra newline

13 years agoAllow subfolders to be reached as attributes
Merlijn van Deen (valhallasw) [Mon, 26 Sep 2011 08:41:41 +0000 (10:41 +0200)]
Allow subfolders to be reached as attributes

13 years agoAdded nicer __repr__esentation to Wave and Folder objects
Merlijn van Deen (valhallasw) [Mon, 26 Sep 2011 08:39:53 +0000 (10:39 +0200)]
Added nicer __repr__esentation to Wave and Folder objects

13 years agoAllow Waves to be directly used as numpy arrays
Merlijn van Deen (valhallasw) [Mon, 26 Sep 2011 08:38:47 +0000 (10:38 +0200)]
Allow Waves to be directly used as numpy arrays

13 years agoUnicode-ify data reading
Merlijn van Deen (valhallasw) [Mon, 26 Sep 2011 08:37:58 +0000 (10:37 +0200)]
Unicode-ify data reading

13 years agoCreated common base class for all parser objects
Merlijn van Deen (valhallasw) [Mon, 26 Sep 2011 08:36:50 +0000 (10:36 +0200)]
Created common base class for all parser objects

13 years agoadd package to pypi
Paul Kienzle [Wed, 27 Apr 2011 15:35:11 +0000 (11:35 -0400)]
add package to pypi

13 years agoinstall instructions
Paul Kienzle [Wed, 27 Apr 2011 15:03:29 +0000 (11:03 -0400)]
install instructions

13 years agoadd setup.py and version info
Paul Kienzle [Wed, 27 Apr 2011 14:53:36 +0000 (10:53 -0400)]
add setup.py and version info

13 years agoimplement reader
Paul Kienzle [Wed, 27 Apr 2011 14:34:53 +0000 (10:34 -0400)]
implement reader