Skip to content

Not having the bc command line utility results in an infinite loop when trying to convert LFmap fits #2

Description

@MijnheerD

I installed this package from Github, as described in the README. I also installed the libcfitsio-dev package from the Ubuntu repository to get the CFITSIO library (specifically the fitsio.h file, which is present in the development version of the package but not in the normal one - this could be useful to add to the documentation). After installing these, I tried to import pylfmap in a Python terminal. This prompted the download, compilation and conversion of LFmap, as expected.

However, I got stuck in an infinite loop, where the following block of text would keep repeating itself:

setting the output map dtype to [dtype('float64')]
File converted to /root/pylfmap/pylfmap/LFmap/LFmap_0.0_healpy.fits
LFmap.config frequency changed from  to 
Opening config file [LFmap.config]
FINALFREQ = 0.000000
BENDFREQ  = 180.000000
ABSFREQ  = 45.000000
OUTFORM  = 4
starting code
read fits maps
convolving map...
convolved map
OUTFORM = 4, writing FITS file
LFmap_0.0.fits

LFmap_1.0 finished!

Clearly, the frequenies are messed up. In the 3rd line, the old and new frequencies are missing. And the FINALFREQ from the config file should not be 0.0 .

After a lot of digging, I managed to understand the problem. The increaseLFmapConfigOutFrequency() function from "LFmap_healpyFitsConvertorAndGenerator.py" uses the bc command line utility (line 62). This was not installed on my system, and resulted in a error message. There is no check for an error in the function, so the program attempts to still set the new frequency using the stdout of the failed process. The result of line 70 are two empty strings, which explains the output above.

Simply installing the bc utility solves this issue. I think it would be good to clearly state this in the README. However, it would be better to rewrite the function to check whether the subprocess actually completed successfully. Or probably even better, try to rewrite the function to not use bc at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions