On 8/30/07, Gary Thompson <garyt@xxxxxxxxxxxxxxx> wrote:
On 8/28/07, gary thompson <garyt.and.sarahb@xxxxxxxxx> wrote:
Dear Seb
The things (I think ;-)) that are generally needed are
1. we should fail quickly if something is wrong
This should happen the instant the user function, in which the data is
read, is executed.
2. the failure message should have
a. a filename with a complete path
This can be done.
b. a line number and a field number
The line number is difficult (and not possible for stability reasons
in the 1.2 line) because of the extract_data() and strip() function in
the io.py file. See the function read() in the file
'specific_fns/relax_data.py' for details as to how the file data is
handled.
c. the line itself with the error indicated
This again is difficult. The line can be pseudo-reconstructed from
the array created by the string.split() function though. Within the
read() function of 'specific_fns/relax_data.py', the original line is
not available because the exact line number has been lost.
error failed to read data from wobble.txt, bad data format!
file: /wibble/wobble.txt had an integer at line 56 column 6 when it should
be a string
1 2 3 b a 6 ...
We can create a new of RelaxError object specifically for this, to
print out a multiline error message. The current message should look
like:
RelaxError: The relaxation data is invalid (num=1, name=0.798308,
data=0.00729703, error=trp).
Maybe the part in brackets can be used rather than printing the
reconstructed line?
3. The things to check for are
a. correct number of arguments
The arguments always have default values, so this check is not
necessary. Maybe checking that the same column hasn't been specified
twice would be useful? Then again, maybe some user would like to say
that the residue name and number are the same thing?
b. the correct type for arguments
This is already done.
allowing comments in these files is also a good idea that i looked at at
one
point
specifically this allows
a. the user (or program) to record meta information abou the file
b. would allow files such as the monte carlo outputs to have meta
information to allow the human reader to more easily distinguish the
sections in the file
Lines starting with '#' and blank lines are already removed by the
strip() function in the io.py file.
any way there are some off the cuff thoughts
That mock error message is much more informative. We definitely need
something very similar in relax.
Cheers,
Edward