Hello,
Access to data files is not part of the API directly. Analysis has
provided some support for this though. The way it does this is through
attaching a link to each spectrum (an API object, class
ccp.api.Nmr.DataSource) of a C world object. So if you have a spectrum
object there is automatically at runtime set up a link
spectrum.block_file (called just block_file below)
The code for the block_file is in ccpnmr1.0/c/memops/global in the files
py_block_file.c and block_file.c. The former is just a wrapper around the
latter, and in particular the former gives the names of the routines that
can be called in the Python world on the Python handle, block_file. Just
looking now, the kind of functionality that exists that you are talking
about in the first question (currently) are two functions.
The first function is:
block_file.getValue(position)
where position is a list or tuple of floating point numbers of the same
dimension as the spectrum. It does an interpolation if the position is
not integral.
The second function is:
block_file.getValues(box_min, box_max)
where the two arguments are lists or tuples of integers which specify the
lower and upper bounds of a box. You get back the points box_min <= x <
box_max. You get them back as a 1D list, not as an ND list of lists of
lists of ... (N times). There are routines in
ccpnmr1.0/python/memops/universal/BlockData.py which let you go from the
1D to the ND representations and back again. (1D -> ND is arrayOfIndex(),
ND -> 1D is indexOfArray(). cumulativeArray() returns what is called the
cumul argument for those two functions.)
We could add more functions if people want them.
Now on the second point we haven't added any "write" functionality, just
"read" functionality. If you give us an idea of what you want then we
could add it. There is a program in the Azara suite imaginatively called
"project" which projects -- as well as possibly transposing -- ND data
sets. So if that is what you needed to do you could use that program and
drive it from Analysis and pick up the new 2D data file that way. The
entire Azara suite should be properly integrated into the API (and hence
Analysis) RSN.
Wayne
On Mon, 12 Dec 2005, Gary Thompson wrote:
> Dear gurus
> I have a couple of requests for information:
>
> 1. I would like to access raw floating point data from spectra on the fly
> can you tell me howto do this?
> 2. Also can you suggest how I might create an empty spectum on the fly (for
> example I would like to create a 2D spectrum that is a projection of a 3d
> spectrum
>
>
> regards
> gary
>
|