You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a small bug in the radmc3Dpy code for reading circular image spectral 'cubes'. It occurs at line 2204 of the image.py file in. the radmc3Dpy module. See the command, and part of the error message below.
Command: im = image.readcircimage('./circimage.out')
Error:
File ~/radmc3d-2.0/python/radmc3dPy/radmc3dPy/image.py:2204, in radmc3dCircimage.readImage(self, filename, old)
2202 for ir in range(self.nr + 1):
2203 s = f.readline().split()
-> 2204 self.image[ir, iphi, 0, inu] = float(s[0])
2205 if self.npol > 1:
2206 self.image[ir, iphi, 1, inu] = float(s[1])
IndexError: list index out of range
The cause of the problem is that for circle image files containing multiple frequencies, the function readImage doesn't account for a blank line between each set of intensities. So the variable 's' at some point is an empty string, causing the error in line 2204.
To fix this issue, I added an extra s=f.readline() to line 2209 of the file. Currently, lines 2200-2210 look like this.
for inu in range(self.nfreq):
for iphi in range(self.nphi):
for ir in range(self.nr + 1):
s = f.readline().split()
self.image[ir, iphi, 0, inu] = float(s[0])
if self.npol > 1:
self.image[ir, iphi, 1, inu] = float(s[1])
self.image[ir, iphi, 2, inu] = float(s[2])
self.image[ir, iphi, 3, inu] = float(s[3])
psize = self.getPixelSize()
With the fix, it should look like this:
for inu in range(self.nfreq):
for iphi in range(self.nphi):
for ir in range(self.nr + 1):
s = f.readline().split()
self.image[ir, iphi, 0, inu] = float(s[0])
if self.npol > 1:
self.image[ir, iphi, 1, inu] = float(s[1])
self.image[ir, iphi, 2, inu] = float(s[2])
self.image[ir, iphi, 3, inu] = float(s[3])
s=f.readline()
psize = self.getPixelSize()
I'm attaching an example image file that you can use to verify. I had to rename it to .txt for github to allow it. circimage.txt
The text was updated successfully, but these errors were encountered:
Hello,
I found a small bug in the
radmc3Dpy
code for reading circular image spectral 'cubes'. It occurs at line 2204 of theimage.py
file in. theradmc3Dpy
module. See the command, and part of the error message below.Command:
im = image.readcircimage('./circimage.out')
Error:
The cause of the problem is that for circle image files containing multiple frequencies, the function
readImage
doesn't account for a blank line between each set of intensities. So the variable 's' at some point is an empty string, causing the error in line 2204.To fix this issue, I added an extra
s=f.readline()
to line 2209 of the file. Currently, lines 2200-2210 look like this.With the fix, it should look like this:
I'm attaching an example image file that you can use to verify. I had to rename it to
.txt
for github to allow it.circimage.txt
The text was updated successfully, but these errors were encountered: