How to Fix an Error with the Setup of IDL/Healpix?

  • Thread starter Lyuokdea
  • Start date
In summary, the conversation is about a person trying to run a simple set of commands using IDL/Healpix software, but the code keeps freezing. They have tried using both a while loop and a for loop, but encountered errors with both. The person is seeking help to fix the issue with their system and mentions encountering a syntax error with the ENDIF command. They ask for assistance in fixing the problem.
  • #1
Lyuokdea
154
0
Put this in the astro forum, since you guys are the most likely to be using this software...please move if that's inappropriate:

I have IDL/Healpix installed on my system, and I'm trying to run what I think should be a fairly simple set of commands, but the code is freezing in the first line of the while loop, without getting to any of the print commands:

The maps in question are healpix format and have about 192000 columns, so it's not that 1000 is larger than the map size.

Code:
read_fits_map, "maps.fits", map
read_fits_map, "mask.fits", mask
numpixels=0
totalvalue=0
numi = 0L
while numi lt 1000 do begin
        if mask[numi] EQ 0 then begin
                totalvalue = totalvalue + map[numi]
                numpixels = numpixels + 1
        endif
        print, numi
        numi = numi + 1
endwhile
print, totalvalue
print, numpixels

I've tried using a for loop:

Code:
Compile_Opt defint32
read_fits_map, "maps.fits", map
read_fits_map, "mask.fits", mask
numpixels=0
totalvalue=0
numi = 0L
for numi=0L, 1, 1000 do begin
        if mask[numi] EQ 0 then begin
                totalvalue = totalvalue + map[numi]
                numpixels = numpixels + 1
        endif
        print, numi
        numi = numi + 1
endfor
print, totalvalue
print, numpixels

and that produces an error on the endif statement of the first run.

Can anybody help me with this?

Thanks in advance,

~Lyuokdea
 
Astronomy news on Phys.org
  • #2
It seems that it is an error with the setup with my system...

going into hidl and typing:

y=-2
if y lt 0 THEN BEGIN
t=2
ENDIF

gives a syntax error on the ENDIF command...however i believe this is entirely correct. Please correct me if I'm wrong, or let me know of a way to fix that.

The same thing happens in normal idl

Thanks,

~Lyuokdea
 

1. What is IDL and how is it related to Healpix?

IDL (Interactive Data Language) is a programming language commonly used in scientific data analysis and visualization. Healpix is a software package designed for analyzing and manipulating data on the sphere, often used in conjunction with IDL.

2. How do I install and set up IDL and Healpix?

The installation and setup process for IDL and Healpix can vary depending on your operating system. It is recommended to follow the official installation guides provided by the developers for the most up-to-date instructions.

3. What are some common uses for IDL and Healpix in scientific research?

IDL and Healpix are commonly used in a variety of fields, including astronomy, cosmology, and Earth sciences. Some specific use cases include analyzing satellite data, simulating galaxy distributions, and studying the cosmic microwave background.

4. Are there any alternatives to using IDL and Healpix?

Yes, there are other software packages available for analyzing spherical data, such as Python's healpy library and the S2 library for C++. However, IDL and Healpix remain popular choices due to their user-friendly interfaces and comprehensive features.

5. Can I use IDL and Healpix for my specific research project?

IDL and Healpix are versatile tools that can be adapted for a wide range of research projects. It is recommended to consult with experienced users or the official documentation to determine if they are suitable for your specific needs.

Similar threads

  • Programming and Computer Science
Replies
12
Views
3K
  • Programming and Computer Science
2
Replies
54
Views
4K
  • Programming and Computer Science
Replies
4
Views
8K
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
7
Views
7K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
13K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
264
  • Programming and Computer Science
Replies
21
Views
8K
  • Programming and Computer Science
Replies
4
Views
4K
Back
Top