Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8904 > unrolled thread

How to use Save/Get for interpolation of unstructured data?

Started byTed Sariyski <tsariysk@craft-tech.com>
First post2012-03-07 10:38 +0000
Last post2012-03-14 05:41 +0000
Articles 6 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  How to use Save/Get for interpolation of unstructured data? Ted Sariyski <tsariysk@craft-tech.com> - 2012-03-07 10:38 +0000
    Re: How to use Save/Get for interpolation of unstructured data? David Bailey <dave@removedbailey.co.uk> - 2012-03-11 09:07 +0000
    Re: How to use Save/Get for interpolation of unstructured Ted Sariyski <tsariysk@craft-tech.com> - 2012-03-12 09:10 +0000
      Re: How to use Save/Get for interpolation of unstructured David Bailey <dave@removedbailey.co.uk> - 2012-03-13 08:04 +0000
      Re: How to use Save/Get for interpolation of unstructured A Retey <awnl@gmx-topmail.de> - 2012-03-14 05:40 +0000
      Re: How to use Save/Get for interpolation of unstructured Ted Sariyski <tsariysk@craft-tech.com> - 2012-03-14 05:41 +0000

#8904 — How to use Save/Get for interpolation of unstructured data?

FromTed Sariyski <tsariysk@craft-tech.com>
Date2012-03-07 10:38 +0000
SubjectHow to use Save/Get for interpolation of unstructured data?
Message-ID<jj7dri$2ds$1@smc.vnet.net>
Hi,

I posted this question a couple of days ago but did not get any 
response. Meanwhile I noticed that the Save-d interpolation data contains
"NDSolve`FEM`ElementMesh", which may relates to my problem. Let me 
restate the question.

I have 2D unstructured data in the form {{{1.22001, 0.00024605}, 
0.816237}, {{1.22334, 0.000250332},0.436219},... } (connectivity is also 
available but I do not know how to use it with Mathematica).

Interpolation issues a warning:

"Interpolation::udeg: Interpolation on unstructured grids is currently 
only supported for InterpolationOrder->1 or InterpolationOrder->All. 
Order will be reduced to 1. >>",

The warning is not an issue for me, the problem is that I cannot use 
Save/Get for this interpolation function. After Get the interpolation 
function instead of a number returns:

intp[1., .8]
     InterpolatingFunction[{{0.000905256237704326, 1.9993734385285347},  {0.00024605021944692736, 0.9989678166248219}},
{4, 4225, 0, {10880, 2}, {2, 2}, 0, 0, 0, 0, Automatic},
{NDSolve`FEM`ElementMesh[{{1.220009724772626, 0.00024605021944692736},
{1.223336731504134, 0.0002503318707254048}, {1.2273720422942693, ...

which is the non-evaluated  content of the Save-d file.

What is the right way to use Save/Get for interpolation of unstructured 
data?

Any help will be highly appreciated.
Thanks,
--Ted

[toc] | [next] | [standalone]


#8959

FromDavid Bailey <dave@removedbailey.co.uk>
Date2012-03-11 09:07 +0000
Message-ID<jjhq0p$itl$1@smc.vnet.net>
In reply to#8904
On 07/03/2012 10:38, Ted Sariyski wrote:
> Hi,
>
> I posted this question a couple of days ago but did not get any
> response. Meanwhile I noticed that the Save-d interpolation data contains
> "NDSolve`FEM`ElementMesh", which may relates to my problem. Let me
> restate the question.
>
> I have 2D unstructured data in the form {{{1.22001, 0.00024605},
> 0.816237}, {{1.22334, 0.000250332},0.436219},... } (connectivity is also
> available but I do not know how to use it with Mathematica).
>
> Interpolation issues a warning:
>
> "Interpolation::udeg: Interpolation on unstructured grids is currently
> only supported for InterpolationOrder->1 or InterpolationOrder->All.
> Order will be reduced to 1.>>",
>
> The warning is not an issue for me, the problem is that I cannot use
> Save/Get for this interpolation function. After Get the interpolation
> function instead of a number returns:
>
> intp[1., .8]
>       InterpolatingFunction[{{0.000905256237704326, 1.9993734385285347},  {0.00024605021944692736, 0.9989678166248219}},
> {4, 4225, 0, {10880, 2}, {2, 2}, 0, 0, 0, 0, Automatic},
> {NDSolve`FEM`ElementMesh[{{1.220009724772626, 0.00024605021944692736},
> {1.223336731504134, 0.0002503318707254048}, {1.2273720422942693, ...
>
> which is the non-evaluated  content of the Save-d file.
>
> What is the right way to use Save/Get for interpolation of unstructured
> data?
>
> Any help will be highly appreciated.
> Thanks,
> --Ted
I think it would help to post some actual code for this. In general, 
surely if you save an interpolation function, you would expect this 
function to be recovered using Get - so I cam't see what the issues is.

David Bailey
http://www.dbaileyconsultancy.co.uk

[toc] | [prev] | [next] | [standalone]


#8973 — Re: How to use Save/Get for interpolation of unstructured

FromTed Sariyski <tsariysk@craft-tech.com>
Date2012-03-12 09:10 +0000
SubjectRe: How to use Save/Get for interpolation of unstructured
Message-ID<jjkehc$1bh$1@smc.vnet.net>
In reply to#8904
On 3/11/2012 5:06 AM, David Bailey wrote:
> On 07/03/2012 10:38, Ted Sariyski wrote:
>> Hi,
>>
>> I posted this question a couple of days ago but did not get any
>> response. Meanwhile I noticed that the Save-d interpolation data contains
>> "NDSolve`FEM`ElementMesh", which may relates to my problem. Let me
>> restate the question.
>>
>> I have 2D unstructured data in the form {{{1.22001, 0.00024605},
>> 0.816237}, {{1.22334, 0.000250332},0.436219},... } (connectivity is also
>> available but I do not know how to use it with Mathematica).
>>
>> Interpolation issues a warning:
>>
>> "Interpolation::udeg: Interpolation on unstructured grids is currently
>> only supported for InterpolationOrder->1 or InterpolationOrder->All.
>> Order will be reduced to 1.>>",
>>
>> The warning is not an issue for me, the problem is that I cannot use
>> Save/Get for this interpolation function. After Get the interpolation
>> function instead of a number returns:
>>
>> intp[1., .8]
>>       InterpolatingFunction[{{0.000905256237704326, 1.9993734385285347},  {0.00024605021944692736, 0.9989678166248219}},
>> {4, 4225, 0, {10880, 2}, {2, 2}, 0, 0, 0, 0, Automatic},
>> {NDSolve`FEM`ElementMesh[{{1.220009724772626, 0.00024605021944692736},
>> {1.223336731504134, 0.0002503318707254048}, {1.2273720422942693, ...
>>
>> which is the non-evaluated  content of the Save-d file.
>>
>> What is the right way to use Save/Get for interpolation of unstructured
>> data?
>>
>> Any help will be highly appreciated.
>> Thanks,
>> --Ted
> I think it would help to post some actual code for this. In general, 
> surely if you save an interpolation function, you would expect this 
> function to be recovered using Get - so I cam't see what the issues is.
>
> David Bailey
> http://www.dbaileyconsultancy.co.uk
>
>
data = Table[{{Random[], Random[]}, Random[]}, {i, 1, 10}];
intp = Interpolation[data];
intp[0.1, 0.2]
Out[]:  1.110174

Save["intp.mat", intp];
Quit[]

Get["intp.mat"];
intp[0.1, 0.7]
Out[]: intp[0.1, 0.7]
InterpolatingFunction[{{0.141559,0.972136},{0.0916656,0.927415}},{4,4225,0,{10,2},{2,2},0,0,0,0,Automatic},{NDSolve`FEM`ElementMesh[{{0.141559,0.972136},{0.0916656,0.927415}},{NDSolve`FEM`TriangleElement[<12>]}]},{0.106611,0.195957,0.105951,0.417478,0.901584,0.324786,0.696795,0.424483,0.192741,0.949504},{Automatic}][0.1,0.7]

[toc] | [prev] | [next] | [standalone]


#8988 — Re: How to use Save/Get for interpolation of unstructured

FromDavid Bailey <dave@removedbailey.co.uk>
Date2012-03-13 08:04 +0000
SubjectRe: How to use Save/Get for interpolation of unstructured
Message-ID<jjmv2v$cg3$1@smc.vnet.net>
In reply to#8973
On 12/03/2012 09:10, Ted Sariyski wrote:
> On 3/11/2012 5:06 AM, David Bailey wrote:
>> On 07/03/2012 10:38, Ted Sariyski wrote:
>>> Hi,
>>>
>>> I posted this question a couple of days ago but did not get any
>>> response. Meanwhile I noticed that the Save-d interpolation data contains
>>> "NDSolve`FEM`ElementMesh", which may relates to my problem. Let me
>>> restate the question.
>>>
>>> I have 2D unstructured data in the form {{{1.22001, 0.00024605},
>>> 0.816237}, {{1.22334, 0.000250332},0.436219},... } (connectivity is also
>>> available but I do not know how to use it with Mathematica).
>>>
>>> Interpolation issues a warning:
>>>
>>> "Interpolation::udeg: Interpolation on unstructured grids is currently
>>> only supported for InterpolationOrder->1 or InterpolationOrder->All.
>>> Order will be reduced to 1.>>",
>>>
>>> The warning is not an issue for me, the problem is that I cannot use
>>> Save/Get for this interpolation function. After Get the interpolation
>>> function instead of a number returns:
>>>
>>> intp[1., .8]
>>>        InterpolatingFunction[{{0.000905256237704326, 1.9993734385285347},  {0.00024605021944692736, 0.9989678166248219}},
>>> {4, 4225, 0, {10880, 2}, {2, 2}, 0, 0, 0, 0, Automatic},
>>> {NDSolve`FEM`ElementMesh[{{1.220009724772626, 0.00024605021944692736},
>>> {1.223336731504134, 0.0002503318707254048}, {1.2273720422942693, ...
>>>
>>> which is the non-evaluated  content of the Save-d file.
>>>
>>> What is the right way to use Save/Get for interpolation of unstructured
>>> data?
>>>
>>> Any help will be highly appreciated.
>>> Thanks,
>>> --Ted

> data = Table[{{Random[], Random[]}, Random[]}, {i, 1, 10}];
> intp = Interpolation[data];
> intp[0.1, 0.2]
> Out[]:  1.110174
>
> Save["intp.mat", intp];
> Quit[]
>
> Get["intp.mat"];
> intp[0.1, 0.7]
> Out[]: intp[0.1, 0.7]
> InterpolatingFunction[{{0.141559,0.972136},{0.0916656,0.927415}},{4,4225,0,{10,2},{2,2},0,0,0,0,Automatic},{NDSolve`FEM`ElementMesh[{{0.141559,0.972136},{0.0916656,0.927415}},{NDSolve`FEM`TriangleElement[<12>]}]},{0.106611,0.195957,0.105951,0.417478,0.901584,0.324786,0.696795,0.424483,0.192741,0.949504},{Automatic}][0.1,0.7]
>

I looked at the file intp.mat, and that appears to be syntactically 
valid, and if you split the above into separate cells, you can see that 
the syntax error does not come from the Get command. However, for some 
reason, the term starting NDSolve`FEM`ElementMesh..... seems to print 
out in skeletal form with <13> - which is obviously invalid. I presume 
you cut and pasted that back to create new input - hence the skeleton 
expression will not parse and gives a syntax error.

I would use the InterpolatingFunction object in the kernel without 
copy/pasting it.

David Bailey
http://www.dbaileyconsultancy.co.uk


[toc] | [prev] | [next] | [standalone]


#9012 — Re: How to use Save/Get for interpolation of unstructured

FromA Retey <awnl@gmx-topmail.de>
Date2012-03-14 05:40 +0000
SubjectRe: How to use Save/Get for interpolation of unstructured
Message-ID<jjpb06$p4i$1@smc.vnet.net>
In reply to#8973
Hi,

>>>
>>> I posted this question a couple of days ago but did not get any
>>> response. Meanwhile I noticed that the Save-d interpolation data contains
>>> "NDSolve`FEM`ElementMesh", which may relates to my problem. Let me
>>> restate the question.
>>>
>>> I have 2D unstructured data in the form {{{1.22001, 0.00024605},
>>> 0.816237}, {{1.22334, 0.000250332},0.436219},... } (connectivity is also
>>> available but I do not know how to use it with Mathematica).
>>>
>>> Interpolation issues a warning:
>>>
>>> "Interpolation::udeg: Interpolation on unstructured grids is currently
>>> only supported for InterpolationOrder->1 or InterpolationOrder->All.
>>> Order will be reduced to 1.>>",
>>>
>>> The warning is not an issue for me, the problem is that I cannot use
>>> Save/Get for this interpolation function. After Get the interpolation
>>> function instead of a number returns:

to me this looks like a bug in exactly the new feature that the warning 
is about, obviously it is new functionality and it has been overlooked 
that it can't be reconstructed from it's FullForm (or InputForm). If you 
do FullForm[intp], copy the result in a new cell and evaluate that you 
will find that this does not work and I think that is about what happens 
and fails within the Save/Get cycle...

For the moment I think the best you can do is to save the data and 
reconstruct the interpolating function after reloading the data.

hth,

albert

[toc] | [prev] | [next] | [standalone]


#9014 — Re: How to use Save/Get for interpolation of unstructured

FromTed Sariyski <tsariysk@craft-tech.com>
Date2012-03-14 05:41 +0000
SubjectRe: How to use Save/Get for interpolation of unstructured
Message-ID<jjpb23$p5n$1@smc.vnet.net>
In reply to#8973
On 3/13/2012 4:03 AM, David Bailey wrote:
> On 12/03/2012 09:10, Ted Sariyski wrote:
>> On 3/11/2012 5:06 AM, David Bailey wrote:
>>> On 07/03/2012 10:38, Ted Sariyski wrote:
>>>> Hi,
>>>>
>>>> I posted this question a couple of days ago but did not get any
>>>> response. Meanwhile I noticed that the Save-d interpolation data contains
>>>> "NDSolve`FEM`ElementMesh", which may relates to my problem. Let me
>>>> restate the question.
>>>>
>>>> I have 2D unstructured data in the form {{{1.22001, 0.00024605},
>>>> 0.816237}, {{1.22334, 0.000250332},0.436219},... } (connectivity is also
>>>> available but I do not know how to use it with Mathematica).
>>>>
>>>> Interpolation issues a warning:
>>>>
>>>> "Interpolation::udeg: Interpolation on unstructured grids is currently
>>>> only supported for InterpolationOrder->1 or InterpolationOrder->All.
>>>> Order will be reduced to 1.>>",
>>>>
>>>> The warning is not an issue for me, the problem is that I cannot use
>>>> Save/Get for this interpolation function. After Get the interpolation
>>>> function instead of a number returns:
>>>>
>>>> intp[1., .8]
>>>>        InterpolatingFunction[{{0.000905256237704326, 1.9993734385285347},  {0.00024605021944692736, 0.9989678166248219}},
>>>> {4, 4225, 0, {10880, 2}, {2, 2}, 0, 0, 0, 0, Automatic},
>>>> {NDSolve`FEM`ElementMesh[{{1.220009724772626, 0.00024605021944692736},
>>>> {1.223336731504134, 0.0002503318707254048}, {1.2273720422942693, ...
>>>>
>>>> which is the non-evaluated  content of the Save-d file.
>>>>
>>>> What is the right way to use Save/Get for interpolation of unstructured
>>>> data?
>>>>
>>>> Any help will be highly appreciated.
>>>> Thanks,
>>>> --Ted
>> data = Table[{{Random[], Random[]}, Random[]}, {i, 1, 10}];
>> intp = Interpolation[data];
>> intp[0.1, 0.2]
>> Out[]:  1.110174
>>
>> Save["intp.mat", intp];
>> Quit[]
>>
>> Get["intp.mat"];
>> intp[0.1, 0.7]
>> Out[]: intp[0.1, 0.7]
>> InterpolatingFunction[{{0.141559,0.972136},{0.0916656,0.927415}},{4,4225,0,{10,2},{2,2},0,0,0,0,Automatic},{NDSolve`FEM`ElementMesh[{{0.141559,0.972136},{0.0916656,0.927415}},{NDSolve`FEM`TriangleElement[<12>]}]},{0.106611,0.195957,0.105951,0.417478,0.901584,0.324786,0.696795,0.424483,0.192741,0.949504},{Automatic}][0.1,0.7]
>>
> I looked at the file intp.mat, and that appears to be syntactically 
> valid, and if you split the above into separate cells, you can see that 
> the syntax error does not come from the Get command. However, for some 
> reason, the term starting NDSolve`FEM`ElementMesh..... seems to print 
> out in skeletal form with <13> - which is obviously invalid. I presume 
> you cut and pasted that back to create new input - hence the skeleton 
> expression will not parse and gives a syntax error.
>
> I would use the InterpolatingFunction object in the kernel without 
> copy/pasting it.
>
> David Bailey
> http://www.dbaileyconsultancy.co.uk
>

> I would use the InterpolatingFunction object in the kernel without 
> copy/pasting it.

The reason I want to use Save/Get is that Interpolation takes a couple of minutes per variable. If using "the InterpolatingFunction object in the kernel without  copy/pasting" will bypass re-Interpolation at every restart, I am very interested. Could you explain or point me to an example how to do it, please? 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web