Zbigniew Jędrzejewski-Szmek [Mon, 28 Feb 2011 07:25:41 +0000 (08:25 +0100)]
EDF: introduce <channel> and <channelset>.
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.
Zbyszek Szmek [Tue, 22 Jun 2010 10:04:31 +0000 (12:04 +0200)]
2to3: remove stray parentheses.
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.
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.
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.
Zbyszek Jędrzejewski-Szmek [Mon, 22 Jun 2009 07:22:23 +0000 (09:22 +0200)]
Better support multiple files specified by user.
Zbyszek Jędrzejewski-Szmek [Mon, 22 Jun 2009 07:22:01 +0000 (09:22 +0200)]
Clean up logging levels and formats.
Zbyszek Jędrzejewski-Szmek [Mon, 22 Jun 2009 07:20:10 +0000 (09:20 +0200)]
Forgotten import.
Zbyszek Jędrzejewski-Szmek [Sun, 21 Jun 2009 12:36:22 +0000 (14:36 +0200)]
Use OptionParser for options in run.py.
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.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 18:09:44 +0000 (20:09 +0200)]
Param channel_name is optional, provide replacement.
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
>>>
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 16:35:12 +0000 (18:35 +0200)]
XML file and XPath in codecs.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 16:18:54 +0000 (18:18 +0200)]
Use helper function to recast InvalidExpressionError.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 16:17:54 +0000 (18:17 +0200)]
Move tedious initialization to helper module.
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.
Zbyszek Jędrzejewski-Szmek [Thu, 18 Jun 2009 14:38:11 +0000 (16:38 +0200)]
Indent M4D.xml.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 23:18:05 +0000 (01:18 +0200)]
Make sample dumping into separate function.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 23:11:52 +0000 (01:11 +0200)]
Utility function codec.open_and_eval().
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 22:55:24 +0000 (00:55 +0200)]
EASYS.xml: make header parsable.
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.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 22:43:22 +0000 (00:43 +0200)]
Use new collections.OrderedDict when possible.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 22:01:22 +0000 (00:01 +0200)]
Unuse deprecated Exception.message. Clean up expception reporting.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 18:54:51 +0000 (20:54 +0200)]
Run twozer.test() from commandline.
Zbyszek Jędrzejewski-Szmek [Mon, 15 Jun 2009 18:58:23 +0000 (20:58 +0200)]
Remove test.py with python encoding test.
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
Zbyszek Szmek [Sun, 5 Apr 2009 18:39:16 +0000 (20:39 +0200)]
Test builtin functions in machine.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
Zbyszek Szmek [Sun, 5 Apr 2009 15:41:43 +0000 (17:41 +0200)]
Remove utility imports from __init__.py.
Zbyszek Szmek [Sun, 5 Apr 2009 15:38:40 +0000 (17:38 +0200)]
Switch to relative imports in codec.py.
Zbyszek Szmek [Sun, 5 Apr 2009 15:38:14 +0000 (17:38 +0200)]
Rename twozer.py to codec.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.
Zbyszek Szmek [Sun, 5 Apr 2009 15:02:17 +0000 (17:02 +0200)]
Algebraic tests, part II.
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?
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).
Zbyszek Szmek [Sat, 4 Apr 2009 23:16:07 +0000 (01:16 +0200)]
Algebraic tests, part I.
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.
Zbyszek Szmek [Sat, 4 Apr 2009 23:03:01 +0000 (01:03 +0200)]
Use loadTestFromModule to get rid of get_suite() functions.
Zbyszek Szmek [Sat, 4 Apr 2009 18:23:25 +0000 (20:23 +0200)]
Additional quoting tests.
Idea from Tiziano Zito.
Zbyszek Szmek [Sat, 4 Apr 2009 18:00:14 +0000 (20:00 +0200)]
Use __init__.py, TestSuites and clean up names.
Zbyszek Szmek [Wed, 4 Mar 2009 12:42:15 +0000 (13:42 +0100)]
Merge branch 'master' of ssh://escher/srv/git/repos/twozer
zbyszek szmek [Tue, 3 Mar 2009 18:07:21 +0000 (19:07 +0100)]
Lists [a,b,c] in expressions.
zbyszek szmek [Sat, 28 Feb 2009 08:53:32 +0000 (09:53 +0100)]
Corrections in writing values out.
zbyszek szmek [Sat, 28 Feb 2009 08:52:57 +0000 (09:52 +0100)]
EDF - corrections.
zbyszek szmek [Wed, 25 Feb 2009 20:45:35 +0000 (21:45 +0100)]
Using file names.
zbyszek szmek [Wed, 25 Feb 2009 20:19:18 +0000 (21:19 +0100)]
Writing sample to file.
zbyszek szmek [Wed, 25 Feb 2009 19:51:23 +0000 (20:51 +0100)]
Logging config from file + errata.
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.
zbyszek szmek [Wed, 25 Feb 2009 19:40:30 +0000 (20:40 +0100)]
Minor corrections.
zbyszek szmek [Wed, 25 Feb 2009 09:11:05 +0000 (10:11 +0100)]
Add header_size to data offset in EDF.xml.
Zbyszek Szmek [Sat, 21 Feb 2009 14:44:55 +0000 (15:44 +0100)]
Opis EASYS.
Zbyszek Szmek [Thu, 12 Feb 2009 08:14:07 +0000 (09:14 +0100)]
Logging in machine.py.
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!
Zbyszek Szmek [Thu, 12 Feb 2009 08:12:42 +0000 (09:12 +0100)]
Mapping works!
Zbyszek Szmek [Wed, 11 Feb 2009 22:04:35 +0000 (23:04 +0100)]
Python encoding bug test.
Zbyszek Szmek [Wed, 11 Feb 2009 22:04:15 +0000 (23:04 +0100)]
First try for XMLSchema.
Zbyszek Szmek [Wed, 11 Feb 2009 22:03:55 +0000 (23:03 +0100)]
Initial <data> support.
Zbyszek Szmek [Wed, 11 Feb 2009 22:02:53 +0000 (23:02 +0100)]
Fix XMLSyntaxError imports.
Zbyszek Szmek [Wed, 11 Feb 2009 22:02:31 +0000 (23:02 +0100)]
More unittests.
Zbyszek Szmek [Mon, 5 Jan 2009 19:01:12 +0000 (20:01 +0100)]
Fix up exceptions in machine.py.
Zbyszek Szmek [Fri, 26 Dec 2008 11:23:24 +0000 (12:23 +0100)]
Support for running without lxml.
Zbyszek Szmek [Fri, 26 Dec 2008 10:09:54 +0000 (11:09 +0100)]
Functions log(), log10() and exp().
Zbyszek Jedrzejewski-Szmek [Tue, 23 Dec 2008 15:51:44 +0000 (16:51 +0100)]
Logical operator 'not'.
Zbyszek Jedrzejewski-Szmek [Tue, 23 Dec 2008 15:51:24 +0000 (16:51 +0100)]
Logical operators 'and' and 'or'.
Zbyszek Jedrzejewski-Szmek [Tue, 23 Dec 2008 14:24:32 +0000 (15:24 +0100)]
expression grammar: introduce topexpr.
Zbyszek Jedrzejewski-Szmek [Tue, 23 Dec 2008 14:23:45 +0000 (15:23 +0100)]
Makefile with tests for now.
Zbyszek Szmek [Thu, 18 Dec 2008 10:15:40 +0000 (11:15 +0100)]
Slice object and syntax.
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.
Zbyszek Szmek [Wed, 17 Dec 2008 17:20:14 +0000 (18:20 +0100)]
WIP.
Zbyszek Szmek [Wed, 17 Dec 2008 16:48:14 +0000 (17:48 +0100)]
Allow overriding builtin parameters.
Zbyszek Szmek [Tue, 16 Dec 2008 23:45:52 +0000 (00:45 +0100)]
User exceptions.
Zbyszek Szmek [Tue, 16 Dec 2008 23:45:37 +0000 (00:45 +0100)]
Fix calls.
Zbyszek Szmek [Tue, 16 Dec 2008 23:05:09 +0000 (00:05 +0100)]
String expressions.
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 17:11:24 +0000 (18:11 +0100)]
FixedOffset -> Binary.
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 12:09:40 +0000 (13:09 +0100)]
Quoted string support.
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 09:50:06 +0000 (10:50 +0100)]
Builtin parameters with arguments (functions).
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 09:19:19 +0000 (10:19 +0100)]
Builtin parameters.
Zbyszek Jedrzejewski-Szmek [Tue, 16 Dec 2008 08:57:45 +0000 (09:57 +0100)]
Initial support for array types.
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.
Zbyszek Szmek [Tue, 16 Dec 2008 05:50:51 +0000 (06:50 +0100)]
Unittesting.
Zbyszek Szmek [Mon, 15 Dec 2008 22:17:35 +0000 (23:17 +0100)]
Exception handling fixlets.
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.
Zbyszek Szmek [Sun, 14 Dec 2008 17:01:36 +0000 (18:01 +0100)]
Some more of m4d content.
Zbyszek Szmek [Sun, 14 Dec 2008 16:59:37 +0000 (17:59 +0100)]
Rename meta_format -> signalml.
Zbyszek Szmek [Sun, 14 Dec 2008 16:56:50 +0000 (17:56 +0100)]
Assertions.
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.
Zbyszek Szmek [Sun, 14 Dec 2008 16:03:53 +0000 (17:03 +0100)]
Text files: for now reads number of channels from m4d.
Zbyszek Jedrzejewski-Szmek [Fri, 12 Dec 2008 20:08:59 +0000 (21:08 +0100)]
Nowy tag <data>.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 14:29:02 +0000 (15:29 +0100)]
Correct edf.xml.
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.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 14:26:03 +0000 (15:26 +0100)]
Fixup globals/state mixup in ExpTree.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 14:01:20 +0000 (15:01 +0100)]
Define mapping in edf.xml.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 14:00:07 +0000 (15:00 +0100)]
More exception care.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 13:56:42 +0000 (14:56 +0100)]
Ternary op was supposed to be lazy!
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 13:56:18 +0000 (14:56 +0100)]
Remove dead code from ExpTree.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 13:29:35 +0000 (14:29 +0100)]
Expressions like --a => (neg (neg a)).
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 13:23:37 +0000 (14:23 +0100)]
New operators: <,<=,>,>=,!=,==,?: .
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 10:22:58 +0000 (11:22 +0100)]
CachingState.
Zbyszek Jedrzejewski-Szmek [Thu, 11 Dec 2008 10:08:30 +0000 (11:08 +0100)]
Bugs in EDF spec and DTD found during header parsing.