Commit d4dc9d03aea51d33f4c34e63070ad0a7c407eb20
1 parent
0644df2f
Exists in
master
setting angle values to undef when Q=U=0
Showing
1 changed file
with
9 additions
and
3 deletions
Show diff stats
src/idl_misc/JPBLib_for_Dustemwrap/General/polar_iqu2ippsi.pro
1 | -PRO polar_iqu2ippsi,I,Q,U,p,psi,p2=p2,help=help,lac=lac | |
1 | +PRO polar_iqu2ippsi,I,Q,U,p,psi,p2=p2,help=help,lac=lac,largep=largep | |
2 | 2 | |
3 | 3 | ;+ |
4 | 4 | ; NAME: |
... | ... | @@ -41,17 +41,23 @@ IF n_params(0) LE 4 THEN BEGIN |
41 | 41 | ENDIF |
42 | 42 | |
43 | 43 | IF keyword_set(lac) THEN BEGIN |
44 | + largep=la_power((la_add(la_power(Q,2.),la_power(U,2.))),0.5) | |
44 | 45 | p2=la_div(la_add(la_power(Q,2.),la_power(U,2.)),la_power(I,2.)) |
45 | - p=la_div(la_power((la_add(la_power(Q,2.),la_power(U,2.))),0.5),I) | |
46 | + p=la_div(largep,I) | |
46 | 47 | psi=0.5*atan(U,Q)/!dtor |
47 | 48 | ind=where(U EQ la_undef() OR Q EQ la_undef(),count) |
48 | 49 | IF count NE 0 THEN psi[ind]=la_undef() |
49 | 50 | ENDIF ELSE BEGIN |
51 | + largep=sqrt(Q^2+U^2) | |
50 | 52 | p2=(Q^2+U^2)/I^2 |
51 | - p=sqrt(Q^2+U^2)/I | |
53 | + p=largep/I | |
52 | 54 | psi=0.5*atan(U,Q)/!dtor |
53 | 55 | ENDELSE |
54 | 56 | |
57 | +;set polarization angle to undefined where P is 0 | |
58 | +ind=where(largep EQ 0.,count) | |
59 | +IF count NE 0 THEN psi[ind]=la_undef() | |
60 | + | |
55 | 61 | sortie: |
56 | 62 | |
57 | 63 | END | ... | ... |