twozer
14 months agoEDF: introduce <channel> and <channelset>. master
Zbigniew Jędrzejewski-Szmek [Mon, 28 Feb 2011 07:25:41 +0000 (08:25 +0100)]
EDF: introduce <channel> and <channelset>.

22 months ago2to3: use string methods not functions.
Zbyszek Szmek [Tue, 22 Jun 2010 10:32:21 +0000 (12:32 +0200)]
2to3: use string methods not functions.

It is better to use a lambda function wrapping the method, because
the first argument to str.strip() is called self, not s, so
str.strip({'s'=' aaa '}) will fail.

22 months ago2to3: remove stray parentheses.
Zbyszek Szmek [Tue, 22 Jun 2010 10:04:31 +0000 (12:04 +0200)]
2to3: remove stray parentheses.

2 years agoExtend description of EASYS with more parameters from standard header.
Zbyszek Jędrzejewski-Szmek [Wed, 5 Aug 2009 18:43:29 +0000 (20:43 +0200)]
Extend description of EASYS with more parameters from standard header.

Includes one binary op.

2 years agoAdd binary operators with same precedence as other binary ops.
Zbyszek Jędrzejewski-Szmek [Wed, 5 Aug 2009 18:43:10 +0000 (20:43 +0200)]
Add binary operators with same precedence as other binary ops.

2 years agoExample XML format where second data filename must be given by user.
Zbyszek Jędrzejewski-Szmek [Mon, 22 Jun 2009 07:22:42 +0000 (09:22 +0200)]
Example XML format where second data filename must be given by user.

2 years agoBetter support multiple files specified by user.
Zbyszek Jędrzejewski-Szmek [Mon, 22 Jun 2009 07:22:23 +0000 (09:22 +0200)]
Better support multiple files specified by user.

2 years agoClean up logging levels and formats.
Zbyszek Jędrzejewski-Szmek [Mon, 22 Jun 2009 07:22:01 +0000 (09:22 +0200)]
Clean up logging levels and formats.

2 years agoForgotten import.
Zbyszek Jędrzejewski-Szmek [Mon, 22 Jun 2009 07:20:10 +0000 (09:20 +0200)]
Forgotten import.

2 years agoUse OptionParser for options in run.py.
Zbyszek Jędrzejewski-Szmek [Sun, 21 Jun 2009 12:36:22 +0000 (14:36 +0200)]
Use OptionParser for options in run.py.

2 years agoRevert "Param channel_name is optional, provide replacement."
Zbyszek Jędrzejewski-Szmek [Sun, 21 Jun 2009 12:35:51 +0000 (14:35 +0200)]
Revert "Param channel_name is optional, provide replacement."

This reverts commit edaf93b5ea16a14ddee6232d9efeaddfa928de81.

Default parameters can be provided through builtin functions.
Let's do it this way.

2 years agoParam channel_name is optional, provide replacement.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 18:09:44 +0000 (20:09 +0200)]
Param channel_name is optional, provide replacement.

2 years agoExample XML codec and data.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 18:09:13 +0000 (20:09 +0200)]
Example XML codec and data.

>>> codec = twozer.Codec('XMLFormatCodec.xml')
[20:08:07 D twozer] element param id='number_of_channels' type=None
[20:08:07 D twozer] element param id='samples_in_file' type='int'
[20:08:07 D twozer] element param id='filename' type=None
[20:08:07 D twozer] element param id='just_bytes' type=None
[20:08:07 D twozer] New arg type=int name=channel
[20:08:07 D twozer] New arg type=int name=sample
[20:08:07 D twozer] element param id='straight_mapping' type='int'
[20:08:07 D twozer] New arg type=int name=channel
[20:08:07 D twozer] New arg type=int name=sample
[20:08:07 D twozer] element data mapping=straight_mapping format=just_bytes
>>> state = c1.open_and_eval('XMLFormatSample.xml')
>>> codec.dump_samples(state)
[20:08:20 I twozer] channel names ['L0']
0 81
1 -128
2 -59
3 -4
4 10
5 69
6 21
7 42
8 70
9 68
10 6
11 39
12 -125
13 21
14 100
15 68
16 -124
17 11
18 -102
19 53
20 122
21 72
22 -61
23 -114
24 12
25 -73
26 -89
27 68
28 -56
29 122
30 -117
31 -98
32 73
33 -98
34 -62
35 -107
36 -73
37 36
38 -22
39 42
40 -16
41 5
42 92
43 5
44 26
45 22
46 -47
47 -33
48 114
49 93
50 -117
51 -41
52 -123
53 -10
54 101
55 121
56 -90
57 -94
58 -28
59 -98
60 120
61 -85
62 -89
63 61
64 110
65 102
66 112
67 -123
68 43
69 -127
70 -71
71 74
72 5
73 -11
74 -107
75 20
76 107
77 -2
78 86
79 -126
80 14
81 -17
82 6
83 8
84 -113
85 -22
86 53
87 6
88 85
89 -115
90 23
91 -5
92 108
93 36
94 49
95 0
96 -103
97 -74
98 99
99 22
>>>

2 years agoXML file and XPath in codecs.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 16:35:12 +0000 (18:35 +0200)]
XML file and XPath in codecs.

2 years agoUse helper function to recast InvalidExpressionError.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 16:18:54 +0000 (18:18 +0200)]
Use helper function to recast InvalidExpressionError.

2 years agoMove tedious initialization to helper module.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 16:17:54 +0000 (18:17 +0200)]
Move tedious initialization to helper module.

2 years agoIncrease recursion limit 300.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 14:41:50 +0000 (16:41 +0200)]
Increase recursion limit 300.

200 was too low for EDF recursive channel_offset()
calculation with 17 channels.

2 years agoIndent M4D.xml.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 14:38:11 +0000 (16:38 +0200)]
Indent M4D.xml.

2 years agoMake sample dumping into separate function.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 23:18:05 +0000 (01:18 +0200)]
Make sample dumping into separate function.

2 years agoUtility function codec.open_and_eval().
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 23:11:52 +0000 (01:11 +0200)]
Utility function codec.open_and_eval().

2 years agoEASYS.xml: make header parsable.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 22:55:24 +0000 (00:55 +0200)]
EASYS.xml: make header parsable.

2 years agoUse quotes when reporting param names.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 22:53:45 +0000 (00:53 +0200)]
Use quotes when reporting param names.

Turns
  twozer.machine.InvalidExpressionError: in param magic attribute format
into
  twozer.machine.InvalidExpressionError: in param 'magic' attribute format
which might be easier to interpret.

2 years agoUse new collections.OrderedDict when possible.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 22:43:22 +0000 (00:43 +0200)]
Use new collections.OrderedDict when possible.

2 years agoUnuse deprecated Exception.message. Clean up expception reporting.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 22:01:22 +0000 (00:01 +0200)]
Unuse deprecated Exception.message. Clean up expception reporting.

2 years agoRun twozer.test() from commandline.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 18:54:51 +0000 (20:54 +0200)]
Run twozer.test() from commandline.

2 years agoRemove test.py with python encoding test.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 18:58:23 +0000 (20:58 +0200)]
Remove test.py with python encoding test.

3 years agoFix bugs in machine.py resulting from testing builtins.
Zbyszek Szmek [Sun, 5 Apr 2009 18:40:24 +0000 (20:40 +0200)]
Fix bugs in machine.py resulting from testing builtins.

ERROR: test_builtin_log (twozer.tests.test_machine.TestBuiltins)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/zbyszek/eeg/twozer/tests/test_machine.py", line 33, in test_builtin_log
    self.assertEqual(1,  self.state.call('log', math.e))
  File "machine.py", line 389, in call
    return meta.eval(self, *params)
  File "machine.py", line 106, in eval
    if len(self.args) != len(params):
TypeError: object of type 'Arg' has no len()

ERROR: test_builtin_log (twozer.tests.test_machine.TestBuiltins)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/zbyszek/eeg/twozer/tests/test_machine.py", line 33, in test_builtin_log
    self.assertEqual(1,  self.state.call('log', math.e))
  File "/home/zbyszek/eeg/twozer/machine.py", line 389, in call
    return meta.eval(self, *params)
  File "/home/zbyszek/eeg/twozer/machine.py", line 116, in eval
    val = self.eval_with_args(state, locals)
  File "/home/zbyszek/eeg/twozer/machine.py", line 252, in eval_with_args
    val = self.func(**args)
TypeError: log() takes no keyword arguments

3 years agoTest builtin functions in machine.py.
Zbyszek Szmek [Sun, 5 Apr 2009 18:39:16 +0000 (20:39 +0200)]
Test builtin functions in machine.py.

3 years agoSplit of codec running code into a separate function and create run.py.
Zbyszek Szmek [Sun, 5 Apr 2009 16:53:35 +0000 (18:53 +0200)]
Split of codec running code into a separate function and create run.py.

run.py imports twozer as a seperate package, not 'from . import codec',
to avoid errors like:
ValueError: Attempted relative import in non-package

3 years agoRemove utility imports from __init__.py.
Zbyszek Szmek [Sun, 5 Apr 2009 15:41:43 +0000 (17:41 +0200)]
Remove utility imports from __init__.py.

3 years agoSwitch to relative imports in codec.py.
Zbyszek Szmek [Sun, 5 Apr 2009 15:38:40 +0000 (17:38 +0200)]
Switch to relative imports in codec.py.

3 years agoRename twozer.py to codec.py.
Zbyszek Szmek [Sun, 5 Apr 2009 15:38:14 +0000 (17:38 +0200)]
Rename twozer.py to codec.py.

3 years agoChange order or import statements in __init__.py.
Zbyszek Szmek [Sun, 5 Apr 2009 15:03:15 +0000 (17:03 +0200)]
Change order or import statements in __init__.py.

Not sure if this is necessary, but... it shouldn't be harmful.

3 years agoAlgebraic tests, part II.
Zbyszek Szmek [Sun, 5 Apr 2009 15:02:17 +0000 (17:02 +0200)]
Algebraic tests, part II.

3 years agoCleanup ExpTree binary operations implementation.
Zbyszek Szmek [Sun, 5 Apr 2009 11:19:47 +0000 (13:19 +0200)]
Cleanup ExpTree binary operations implementation.

Why python operator modules doesn't contain binary logical operators?

3 years agoDefine spinner before import modules, create test suite dynimically.
Zbyszek Szmek [Sun, 5 Apr 2009 11:17:24 +0000 (13:17 +0200)]
Define spinner before import modules, create test suite dynimically.

get_suite() is used to make reloading modules easier: after
test_Something.py is reloaded, tests/__init__.py doesn't have to be
reloaded.

Import failed because modules tried to use spinner when being imported.
To correct this, spinner is defined earlier (and now actually works
instead of calling an old definition of _spinner).

3 years agoAlgebraic tests, part I.
Zbyszek Szmek [Sat, 4 Apr 2009 23:16:07 +0000 (01:16 +0200)]
Algebraic tests, part I.

3 years agoA simple spinner to make test nicer.
Zbyszek Szmek [Sat, 4 Apr 2009 23:03:26 +0000 (01:03 +0200)]
A simple spinner to make test nicer.

A rip-off from MDP.

3 years agoUse loadTestFromModule to get rid of get_suite() functions.
Zbyszek Szmek [Sat, 4 Apr 2009 23:03:01 +0000 (01:03 +0200)]
Use loadTestFromModule to get rid of get_suite() functions.

3 years agoAdditional quoting tests.
Zbyszek Szmek [Sat, 4 Apr 2009 18:23:25 +0000 (20:23 +0200)]
Additional quoting tests.

Idea from Tiziano Zito.

3 years agoUse __init__.py, TestSuites and clean up names.
Zbyszek Szmek [Sat, 4 Apr 2009 18:00:14 +0000 (20:00 +0200)]
Use __init__.py, TestSuites and clean up names.

3 years agoMerge branch 'master' of ssh://escher/srv/git/repos/twozer
Zbyszek Szmek [Wed, 4 Mar 2009 12:42:15 +0000 (13:42 +0100)]
Merge branch 'master' of ssh://escher/srv/git/repos/twozer

3 years agoLists [a,b,c] in expressions.
zbyszek szmek [Tue, 3 Mar 2009 18:07:21 +0000 (19:07 +0100)]
Lists [a,b,c] in expressions.

3 years agoCorrections in writing values out.
zbyszek szmek [Sat, 28 Feb 2009 08:53:32 +0000 (09:53 +0100)]
Corrections in writing values out.

3 years agoEDF - corrections.
zbyszek szmek [Sat, 28 Feb 2009 08:52:57 +0000 (09:52 +0100)]
EDF - corrections.

3 years agoUsing file names.
zbyszek szmek [Wed, 25 Feb 2009 20:45:35 +0000 (21:45 +0100)]
Using file names.

3 years agoWriting sample to file.
zbyszek szmek [Wed, 25 Feb 2009 20:19:18 +0000 (21:19 +0100)]
Writing sample to file.

3 years agoLogging config from file + errata.
zbyszek szmek [Wed, 25 Feb 2009 19:51:23 +0000 (20:51 +0100)]
Logging config from file + errata.

3 years agoFormat attribute and making use of it.
zbyszek szmek [Wed, 25 Feb 2009 19:41:13 +0000 (20:41 +0100)]
Format attribute and making use of it.

Seems to correctly read samples from EDF.

3 years agoMinor corrections.
zbyszek szmek [Wed, 25 Feb 2009 19:40:30 +0000 (20:40 +0100)]
Minor corrections.

3 years agoAdd header_size to data offset in EDF.xml.
zbyszek szmek [Wed, 25 Feb 2009 09:11:05 +0000 (10:11 +0100)]
Add header_size to data offset in EDF.xml.

3 years agoOpis EASYS.
Zbyszek Szmek [Sat, 21 Feb 2009 14:44:55 +0000 (15:44 +0100)]
Opis EASYS.

3 years agoLogging in machine.py.
Zbyszek Szmek [Thu, 12 Feb 2009 08:14:07 +0000 (09:14 +0100)]
Logging in machine.py.

3 years agostate must be passed everywhere during execution.
Zbyszek Szmek [Thu, 12 Feb 2009 08:13:49 +0000 (09:13 +0100)]
state must be passed everywhere during execution.

It only worked before because state was accessed as a global variable.
Yuck!

3 years agoMapping works!
Zbyszek Szmek [Thu, 12 Feb 2009 08:12:42 +0000 (09:12 +0100)]
Mapping works!

3 years agoPython encoding bug test.
Zbyszek Szmek [Wed, 11 Feb 2009 22:04:35 +0000 (23:04 +0100)]
Python encoding bug test.

3 years agoFirst try for XMLSchema.
Zbyszek Szmek [Wed, 11 Feb 2009 22:04:15 +0000 (23:04 +0100)]
First try for XMLSchema.

3 years agoInitial <data> support.
Zbyszek Szmek [Wed, 11 Feb 2009 22:03:55 +0000 (23:03 +0100)]
Initial <data> support.

3 years agoFix XMLSyntaxError imports.
Zbyszek Szmek [Wed, 11 Feb 2009 22:02:53 +0000 (23:02 +0100)]
Fix XMLSyntaxError imports.

3 years agoMore unittests.
Zbyszek Szmek [Wed, 11 Feb 2009 22:02:31 +0000 (23:02 +0100)]
More unittests.

3 years agoFix up exceptions in machine.py.
Zbyszek Szmek [Mon, 5 Jan 2009 19:01:12 +0000 (20:01 +0100)]
Fix up exceptions in machine.py.

3 years agoSupport for running without lxml.
Zbyszek Szmek [Fri, 26 Dec 2008 11:23:24 +0000 (12:23 +0100)]
Support for running without lxml.

3 years agoFunctions log(), log10() and exp().
Zbyszek Szmek [Fri, 26 Dec 2008 10:09:54 +0000 (11:09 +0100)]
Functions log(), log10() and exp().

3 years agoLogical operator 'not'.
Zbyszek Jedrzejewski-Szmek [Tue, 23 Dec 2008 15:51:44 +0000 (16:51 +0100)]
Logical operator 'not'.

3 years agoLogical operators 'and' and 'or'.
Zbyszek Jedrzejewski-Szmek [Tue, 23 Dec 2008 15:51:24 +0000 (16:51 +0100)]
Logical operators 'and' and 'or'.

3 years agoexpression grammar: introduce topexpr.
Zbyszek Jedrzejewski-Szmek [Tue, 23 Dec 2008 14:24:32 +0000 (15:24 +0100)]
expression grammar: introduce topexpr.

3 years agoMakefile with tests for now.
Zbyszek Jedrzejewski-Szmek [Tue, 23 Dec 2008 14:23:45 +0000 (15:23 +0100)]
Makefile with tests for now.

3 years agoSlice object and syntax.
Zbyszek Szmek [Thu, 18 Dec 2008 10:15:40 +0000 (11:15 +0100)]
Slice object and syntax.

3 years agoBeef up argument counting and reporting in function calls.
Zbyszek Szmek [Wed, 17 Dec 2008 21:06:22 +0000 (22:06 +0100)]
Beef up argument counting and reporting in function calls.

Standardise on channel names available under channel_name (without 's').
The called is supposed to cope with getting an array.

3 years agoWIP.
Zbyszek Szmek [Wed, 17 Dec 2008 17:20:14 +0000 (18:20 +0100)]
WIP.

3 years agoAllow overriding builtin parameters.
Zbyszek Szmek [Wed, 17 Dec 2008 16:48:14 +0000 (17:48 +0100)]
Allow overriding builtin parameters.

3 years agoUser exceptions.
Zbyszek Szmek [Tue, 16 Dec 2008 23:45:52 +0000 (00:45 +0100)]
User exceptions.

3 years agoFix calls.
Zbyszek Szmek [Tue, 16 Dec 2008 23:45:37 +0000 (00:45 +0100)]
Fix calls.

3 years agoString expressions.
Zbyszek Szmek [Tue, 16 Dec 2008 23:05:09 +0000 (00:05 +0100)]
String expressions.

3 years agoFixedOffset -> Binary.
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 17:11:24 +0000 (18:11 +0100)]
FixedOffset -> Binary.

3 years agoQuoted string support.
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 12:09:40 +0000 (13:09 +0100)]
Quoted string support.

3 years agoBuiltin parameters with arguments (functions).
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 09:50:06 +0000 (10:50 +0100)]
Builtin parameters with arguments (functions).

3 years agoBuiltin parameters.
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 09:19:19 +0000 (10:19 +0100)]
Builtin parameters.

3 years agoInitial support for array types.
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 08:57:45 +0000 (09:57 +0100)]
Initial support for array types.

3 years agoChange order (expr|..., args) to (args,expr|...).
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 08:31:41 +0000 (09:31 +0100)]
Change order (expr|..., args) to (args,expr|...).

This is more natural, because args are 'declared' before use.

3 years agoUnittesting.
Zbyszek Szmek [Tue, 16 Dec 2008 05:50:51 +0000 (06:50 +0100)]
Unittesting.

3 years agoException handling fixlets.
Zbyszek Szmek [Mon, 15 Dec 2008 22:17:35 +0000 (23:17 +0100)]
Exception handling fixlets.

3 years agoExchange various attributes to child elements.
Zbyszek Szmek [Mon, 15 Dec 2008 22:17:23 +0000 (23:17 +0100)]
Exchange various attributes to child elements.

Attributes like offset, format, eval, pattern and line are certainly content, not metadata.
Additionally, eval and offset, and pattern can be quite long and it seems
resonable to convert them to child elements.

3 years agoSome more of m4d content.
Zbyszek Szmek [Sun, 14 Dec 2008 17:01:36 +0000 (18:01 +0100)]
Some more of m4d content.

3 years agoRename meta_format -> signalml.
Zbyszek Szmek [Sun, 14 Dec 2008 16:59:37 +0000 (17:59 +0100)]
Rename meta_format -> signalml.

3 years agoAssertions.
Zbyszek Szmek [Sun, 14 Dec 2008 16:56:50 +0000 (17:56 +0100)]
Assertions.

3 years agotwozer.py: running with no data file.
Zbyszek Szmek [Sun, 14 Dec 2008 16:04:46 +0000 (17:04 +0100)]
twozer.py: running with no data file.

Running with no data filename only checks the format specification for errors.

3 years agoText files: for now reads number of channels from m4d.
Zbyszek Szmek [Sun, 14 Dec 2008 16:03:53 +0000 (17:03 +0100)]
Text files: for now reads number of channels from m4d.

3 years agoNowy tag <data>.
Zbyszek Jedrzejewski-Szmek [Fri, 12 Dec 2008 20:08:59 +0000 (21:08 +0100)]
Nowy tag <data>.

3 years agoCorrect edf.xml.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 14:29:02 +0000 (15:29 +0100)]
Correct edf.xml.

3 years agoMore exception care: DataFormatException.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 14:28:50 +0000 (15:28 +0100)]
More exception care: DataFormatException.

Conversion error - in ReadParam gives DataFormatException
                 - in EvalParam gives CodecError.

3 years agoFixup globals/state mixup in ExpTree.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 14:26:03 +0000 (15:26 +0100)]
Fixup globals/state mixup  in ExpTree.

3 years agoDefine mapping in edf.xml.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 14:01:20 +0000 (15:01 +0100)]
Define mapping in edf.xml.

3 years agoMore exception care.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 14:00:07 +0000 (15:00 +0100)]
More exception care.

3 years agoTernary op was supposed to be lazy!
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 13:56:42 +0000 (14:56 +0100)]
Ternary op was supposed to be lazy!

3 years agoRemove dead code from ExpTree.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 13:56:18 +0000 (14:56 +0100)]
Remove dead code from ExpTree.

3 years agoExpressions like --a => (neg (neg a)).
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 13:29:35 +0000 (14:29 +0100)]
Expressions like --a => (neg (neg a)).

3 years agoNew operators: <,<=,>,>=,!=,==,?: .
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 13:23:37 +0000 (14:23 +0100)]
New operators: <,<=,>,>=,!=,==,?: .

3 years agoCachingState.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 10:22:58 +0000 (11:22 +0100)]
CachingState.

3 years agoBugs in EDF spec and DTD found during header parsing.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 10:08:30 +0000 (11:08 +0100)]
Bugs in EDF spec and DTD found during header parsing.