The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Ruler?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

irek

Japan
14 Posts

Posted - 05/26/2003 :  10:58:51 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi All,
I frequently need to measure the distance between two arbitrary points in Graph window (e.g. rought estimate of line width).
Is it in Origin any tool which could help me? Like simple ruler?
If no, I think it will be useful tool in a future version of Origin or Origin NMR!
Irek

Mike Buess

USA
3037 Posts

Posted - 05/26/2003 :  11:38:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Irek,

ONMR 7 will make that estimate for you as follows...

1. Select Display->Data Cursor->Show Cursor.

2. Move the cursor to the peak point using the mouse or arrow keys. If you only have one peak or are just concerned with the highest you can select Display->Data Cursor->Snap to Peak to find it automatically.

3. Select Display->Data Cursor->Show FWHM. Origin's Data Display tool now shows the following values for the peak point: X, R and W, where W is the estimated fwhm obtained exactly as you would do it graphically. Namely, the routine finds the points on either side of the peak with one-half its Y-value. If the half-max lies between two points its X-value is obtained by interpolation.

Note: As long as Show FWHM is checked ONMR will estimate the peak width at the current Data Cursor position when it is moved or the plot window is redrawn. Naturally that estimate will often be meaningless (i.e., when the cursor is on a baseline) and can slow down other operations. Therefore, I recommend that you keep Show FWHM unchecked unless you really need it.

I hope that helps.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 05/26/2003 11:39:51 AM
Go to Top of Page

easwar

USA
1965 Posts

Posted - 05/26/2003 :  9:04:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Irek,

For a general tool to find distance between two points, you could start with script such as pasted below. You could put such script behind a button, such as the Custom Routine (looks like flow chart, on standard toolbar) button. To use the Custom Routine button, place the code in custom.ogs file and comment out the top lines in that file.

Easwar
OriginLab.

 
count=1;
dotool 2; // set cursor to screen reader

def quittoolbox // this is the main loop where all code subsequtent
{ // to accepting points needs to be placed
if( 2 != count ) //first check if user has successfully selected two points
return;

type Point1: ($(xpos1),$(ypos1)); // report x,y and differences
type Point2: ($(xpos2),$(ypos2));
type Distance in x: $(xpos2-xpos1);
type Distance in y: $(ypos2-ypos1);
type ;
}

def pointproc // this routine gets the points
{ // and store them
xpos$(count)=x;
ypos$(count)=y;
if( count >= 2 )
dotool 0; // set cursor back to pointer
count+=1;
}


Go to Top of Page

irek

Japan
14 Posts

Posted - 05/28/2003 :  05:25:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you, Mike!
Your ONMR is deep as sea! :) There are so many functions in ONMR and it seems I use only few of them!
But what you propose is not exactly what I want. FWHM is good , but for example how to measure distance between two peaks for estimate quadrupole splitting?
May be there is some special function in ONMR, but I don't know it. :(
A simple ruler will be usefull!
Thank you for help!
Go to Top of Page

irek

Japan
14 Posts

Posted - 05/28/2003 :  05:37:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Easwar
I don't know well LabTalk, so I don't know why your script doesn't want to calculate me the distance between points. :(
As you proposed I putted your script in custom.ogs in the Main section:
[Main]
count=1;
dotool 2;// set cursor to screen reader

def quittoolbox // this is the main loop where all code subsequtent
{ // to accepting points needs to be placed
if( 2 != count ) //first check if user has successfully selected two points
return;

type Point1: ($(xpos1),$(ypos1));// report x,y and differences
type Point2: ($(xpos2),$(ypos2));
type Distance in x: $(xpos2-xpos1);
type Distance in y: $(ypos2-ypos1);
type ;
}

def pointproc // this routine gets the points
{// and store them
xpos$(count)=x;
ypos$(count)=y;
if( count >= 2 )
dotool 0;// set cursor back to pointer
count+=1;
}

And it seems that after pushing the Custome Routine button in toolbar only first two lines are executing - the Data Display activating. I tried any combinations of simple mouse clicks, double clicks - and every time I see in Data Display only the current position of marker.
Where I am wrong?

Is it possible to write same function in Origin C?
Thank you in advance!
Irek
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 05/28/2003 :  08:44:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Irek,

I copied Easwar's code from his post to Custom.ogs and it works fine. Maybe you're not using the screen reader correctly. A single-click merely shows the coordinates in the Data Display. A double-click (or Enter) is required to trigger the pointproc macro. Also, make sure the script window is open when you start.

...Another simple method is to copy the text from the Data Display (right-click+Copy Text) to the script window and doing the math there.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 05/28/2003 08:59:31 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000