comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Relative distances between vector elements and search for matches in other vector.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Relative distances between vector elements and search for matches in other vector. [message #80143 is a reply to message #80022] Fri, 27 April 2012 07:26 Go to previous message
Tito is currently offline  Tito
Messages: 16
Registered: March 2012
Junior Member
Dear Gianguido,

> In general, I am still confused about what you are trying to do. Could you give a simple example of input and output? Something like
> ;inputs:
> r1=[1,3,3,4,5]
> r2=[2,-1,4,3]

I will try to explain :)

I have this vectors:
Wavelength: (lets call it 'spec = Double[40]')
1572.6780 1573.0127 1573.3506 1573.6405 1573.6990
1573.8116 1574.0538 1574.2353 1574.4169 1574.7384
1574.7856 1574.8598 1575.0498 1575.1705 1575.2022
1575.5655 1575.7488 1575.9235 1575.9886 1576.0250
1576.1455 1576.5514 1576.7996 1576.9631 1577.1086
1577.2545 1577.3844 1577.6127 1577.7395 1577.8119
1577.9117 1578.0769 1578.2476 1578.6911 1579.1422
1579.3361 1579.5977 1579.6965 1579.8723 1580.0659


and :
Depths (lets call it 'dep = Double[40]' which I am going to need later on)
0.37406952 0.24975741 0.36841672 0.72394320 0.39689800
0.85735723 0.45238194 0.88476935 0.47967704 0.57341885
0.69364480 0.71783461 0.90553347 0.85711051 0.82898679
0.45230935 0.79680740 0.81328328 0.86826340 0.89866642
0.63804183 0.50215458 0.70966639 0.44995926 0.77566860
0.46117208 0.44478282 0.56285968 0.69161155 0.44447514
0.89239487 0.63570633 0.40267729 0.39813661 0.36184048
0.88953285 0.36669691 0.88203417 0.86033273 0.45937277


So this is All the peaks (actually minimums) of a spectrum. I have Depths on Y axis and Wavelengths on X axis.

Now there is two types of lines that I want to distinguish from 2 catalogs.

Firs one is:
HITRAN = Double[18] wavelengths:
1572.6598 1572.9920 1573.3317 1573.6790 1574.0339
1574.3965 1574.7667 1575.7256 1576.1226 1576.5273
1576.9396 1577.3596 1577.7872 1578.2224 1578.6653
1579.1158 1579.5739 1580.0395

and the second:
VALD = Double[44] wavelengths:
1573.5713 1573.7811 1573.8207 1574.5017 1574.6219
1574.7876 1574.7883 1575.3189 1575.3291 1575.3502
1575.3588 1575.6021 1575.7971 1576.5622 1576.8632
1576.8819 1576.9953 1577.0055 1577.0098 1577.0150
1577.1689 1577.1878 1577.3403 1577.3732 1577.4928
1577.8381 1578.1040 1578.5977 1578.8859 1578.9233
1579.0978 1579.1627 1579.3312 1579.3826 1580.1757
1580.2550 1580.2879 1580.3051 1580.3843 1580.5266
1580.8015 1581.0597 1581.2374 1581.4767
Now My idea is to find the distances between the lines in the spectrum and in the catalogs and then identify both populations based on their relative distances.

Thanks to David I did this:

;Finding the relative distance bettwen the HITRAN lines (nm):

ratio_hitran = HITRAN[0] - HITRAN

;Finding the relative distance bettwen each line on the spectrum:

ratio_spec = spec[0] - spec

;Finding the relative distance bettwen the lines from the VALD catalog:

ratio_vald = VALD[0] - VALD

And I get this after substracting:

ratio_hitran = 0.0000000 -0.33218057 -0.67191942 -1.0192411 -1.3741670
-1.7367149 -2.1069002 -3.0658462 -3.4628346 -3.8674891
-4.2798071 -4.6997833 -5.1274089 -5.5626720 -6.0055574
-6.4560465 -6.9141175 -7.3797447

ratio_spec = 0.0000000 -0.33465711 -0.67260343 -0.96251210 -1.0209528
-1.1335506 -1.3758041 -1.5572456 -1.7388401 -2.0604169
-2.1075366 -2.1817349 -2.3717436 -2.4924497 -2.5241943
-2.8874598 -3.0707372 -3.2454473 -3.3105429 -3.3469536
-3.4675066 -3.8733788 -4.1215987 -4.2850644 -4.4306307
-4.5765029 -4.7063881 -4.9347199 -5.0614689 -5.1339078
-5.2336548 -5.3988798 -5.5696123 -6.0131190 -6.4641985
-6.6580319 -6.9196382 -7.0184672 -7.1942482 -7.3878522

ratio_vald = 0.0000000 -0.20975704 -0.24936781 -0.93035298 -1.0505857
-1.2162307 -1.2169309 -1.7475752 -1.7577780 -1.7788837
-1.7874861 -2.0307522 -2.2257052 -2.9908133 -3.2918951
-3.3106002 -3.4239310 -3.4341338 -3.4384350 -3.4436364
-3.5975783 -3.6164834 -3.7689249 -3.8018338 -3.9214663
-4.2667602 -4.5326325 -5.0263668 -5.3145451 -5.3519353
-5.5265028 -5.5913204 -5.7598662 -5.8112802 -6.6043959
-6.6836174 -6.7165264 -6.7337311 -6.8129526 -6.9552913
-7.2301661 -7.4883363 -7.6660846 -7.9053497
Now in 'ratio_spec' Some of the relative distances belong to ratio_HITRAN and the rest that are left belong to ratio_VALD(some of them).


Example:
ratio_hitran = 0.0000000 -0.33218057 -0.67191942 -1.0192411 -1.3741670
ratio_spec = 0.0000000 -0.33465711 -0.67260343 -0.9625121 -1.3758041

Are exactly the same lines from the spectra and from catalog( they differ slightly in the +/- 0.05 criteria) but I can identify them based on their distance from the first line.

I Want to do it not only respect to the first line, I want to find lines based on their distances one respect to another ( example: ratio_spec[i] - ratio_spec[i+1] is the same like ratio_vald[k] - ratio_vald[k+4])


Then also tricky is after I identify the catalog lines in to the spectra, to pass them the depths from the spectra. e.g. where I have match on
spec[0:3]:
1572.6780 1573.0127 1573.3506 1573.6405
HITRAN[0:3]:
1572.6598 1572.9920 1573.3317 1573.6790

to give both:
dep[0:3]
0.37406952 0.24975741 0.36841672 0.72394320

and I am able to perform the first step, I am identifying the HITRAN lines and pass them the depts. But this is due to the fact that the first line in 'hitran' and on 'spec' is the same and it is easy. but if this is not the case as it is with the VALD catalog I have no idea how to do it and to pass the depths...


I hope I explain it good.

All the best,
Trifon
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: How to make an input parameters file??
Next Topic: Time series.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:18:25 PDT 2025

Total time taken to generate the page: 0.00192 seconds