Re: Tracking and plotting particle trajectories 3D [message #82378] |
Sat, 08 December 2012 01:03 |
Mats Löfdahl
Messages: 263 Registered: January 2012
|
Senior Member |
|
|
Den lördagen den 8:e december 2012 kl. 03:48:37 UTC+1 skrev Craig Markwardt:
> On Friday, December 7, 2012 2:32:06 PM UTC-5, abhi...@gmail.com wrote:
>
>> Hi guys, I am working on a code to track and plot particle trajectories. I use a fortran code to create data for position of each particle on x, y and z axis. I use IDL to take in the data from the file and plot it. The problem is that the program connects a line from the end point of one trajectory to the beginning of the new trajectory. This creates a lot of mess and the plot is rendered un-informational. The reason the program is doing this is because the input file has trajectory points for each particle in order. So when one particle finishes its path, the input file gives data for the next particle which has just been generated. I do not want to use loops and slow the speed. Any ideas on how I can remove those connecting lines?
>
>
>
> If it were me, I would use a FOR loop, selecting one particle trajectory at a time, and plotting it. If you want to get clever, you can do as David says and insert a NAN value at each breakpoint between trajectories. But you're basically going to need a FOR loop to do that anyway, so why bother.
The fortran program that generates the trajectory data file presumably knows where one trajectory ends and another starts. If you have the source of that, maybe you could insert the NaNs in the file.
|
|
|
Re: Tracking and plotting particle trajectories 3D [message #82381 is a reply to message #82378] |
Fri, 07 December 2012 18:48  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Friday, December 7, 2012 2:32:06 PM UTC-5, abhi...@gmail.com wrote:
> Hi guys, I am working on a code to track and plot particle trajectories. I use a fortran code to create data for position of each particle on x, y and z axis. I use IDL to take in the data from the file and plot it. The problem is that the program connects a line from the end point of one trajectory to the beginning of the new trajectory. This creates a lot of mess and the plot is rendered un-informational. The reason the program is doing this is because the input file has trajectory points for each particle in order. So when one particle finishes its path, the input file gives data for the next particle which has just been generated. I do not want to use loops and slow the speed. Any ideas on how I can remove those connecting lines?
If it were me, I would use a FOR loop, selecting one particle trajectory at a time, and plotting it. If you want to get clever, you can do as David says and insert a NAN value at each breakpoint between trajectories. But you're basically going to need a FOR loop to do that anyway, so why bother.
Craig
|
|
|
Re: Tracking and plotting particle trajectories 3D [message #82383 is a reply to message #82381] |
Fri, 07 December 2012 12:13  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
abhispace@gmail.com writes:
> Hi guys, I am working on a code to track and plot particle trajectories. I use a fortran code to create data for position of each particle on x, y and z axis. I use IDL to take in the data from the file and plot it. The problem is that the program connects a line from the end point of one trajectory to the beginning of the new trajectory. This creates a lot of mess and the plot is rendered un-informational. The reason the program is doing this is because the input file
has trajectory points for each particle in order. So when one particle finishes its path, the input file gives data for the next particle which has just been generated. I do not want to use loops and slow the speed. Any ideas on how I can remove those connecting lines?
I have an idea. First, identify them, then remove them!
Actually, it might be better to replace them. I'd try
replacing them with NaNs. That might work, although you
don't give us a clue what command you are using to draw
them.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|