Page 1 of 1
immerge problem, potentially with Apple M1 silicon?
Posted: Wed May 11, 2022 9:00 pm
by simonp
Hi guys,
I'm trying to combine a low-resolution image with a high-resolution one with immerge with the following parameters:
Code: Select all
in = high_res.im,low_res.im
out = merged.im
factor = 1.
options = notaper
Upon running immerge on my Apple M1 silicon laptop (Monterey 12.3.1) with miriad version 20220505, the resultant image is non-sensical. Miriad was installed using a binary installation following the instructions under "Install Miriad using binary installation on a Mac". The resulting image looks like (on a 90% scale with a pixel flux range over 5-6 orders of magnitude):
As a check I ran the immerge on our server (miriad version 20211230) , as well as on WSL (Ubuntu 20.) on my personal laptop (miriad version 20220505). Both produced the desired results being:
Any ideas what may/may not be happening? Apologies if I haven't included any information.
Re: immerge problem, potentially with Apple M1 silicon?
Posted: Thu May 12, 2022 10:49 am
by Mark.Wieringa
Hi Simon,
the M1 version has not been widely used so there may well be issues. Can you confirm which version you are actually running?
The darwin_x86_64 version (using Rosetta) or the darwin_arm64 version.
I have received other reports the Rosetta method does not work reliably with Miriad.
Cheers,
Mark
Re: immerge problem, potentially with Apple M1 silicon?
Posted: Thu May 12, 2022 7:11 pm
by simonp
Hi Mark,
Thanks for the reply. I can confirm that I was using the 'miriad-darwin_arm64' version,
Cheers,
Simon.
Re: immerge problem, potentially with Apple M1 silicon?
Posted: Mon May 16, 2022 2:48 am
by simonp
Hi Mark,
Just playing about with the non-sensical output from miriad's immerge on my M1, using the following python script:
Code: Select all
import numpy as np
from astropy.io import fits
import matplotlib.pylab as plt
fitsfile = 'merged.im.fits' # Non-sensical output of immerge as a fits
with fits.open(fitsfile) as hdul:
data = hdul[0].data[0] # Take 1st frequency channel as an example
img = np.fft.ifft2(data).real # Inverse Fourier transform the image
plt.close('all')
plt.imshow(img.real, vmin=0, cmap='plasma')
plt.savefig('immerged_ifft.png')
plt.show()
The resulting image is:
- immerged_ifft.png (145.15 KiB) Viewed 40845 times
From that image, it looks like there are two copies of the desired (I think?) result concatenated along the image x-axis. The left hand image appears inverted around the x-axis wrt the right hand image.
Further more, assuming immerge's output is still in the frequency domain, if I shift the image so the DC component is at the centre of the resultant array, and plot the results of the following python script:
Code: Select all
import numpy as np
from astropy.io import fits
import matplotlib.pylab as plt
fitsfile = 'merged.im.fits'
with fits.open(fitsfile) as hdul:
data = hdul[0].data[0] # Take 1st frequency channel
data = np.fft.fftshift(data)
plt.close('all')
plt.imshow(np.log10(np.abs(data)), cmap='plasma')
plt.savefig('immerged.png')
plt.show()
I get the following image in the frequency domain which is a little puzzling:
- immerged.png (203.17 KiB) Viewed 40845 times
Re: immerge problem, potentially with Apple M1 silicon?
Posted: Tue May 17, 2022 9:22 am
by Mark.Wieringa
Hi Simon,
interesting findings. I did think the first image you posted looked like the FT of what you wanted - and it seems it is something like that.
I will have a closer look at this today.
Cheers,
Mark
Re: immerge problem, potentially with Apple M1 silicon?
Posted: Tue May 17, 2022 6:00 pm
by Mark.Wieringa
Hi Simon,
it turns out this is a problem we've seen before - and it was fixed in January. What version does you immerge report when you run it?
I get: immerge: Revision 1.9, 2022/01/12 03:58:09 UTC
I tried this version and it seems to do the right thing.
Cheers,
Mark
Re: immerge problem, potentially with Apple M1 silicon?
Posted: Wed May 18, 2022 2:34 am
by simonp
Hi Mark,
When checking the immerge version on my Apple M1:
immerge: Revision 1.8, 2021/06/02 04:45:09 UTC
Strangely, when I check the immerge version on our server (which produced the correct immerge result), I also get:
immerge: Revision 1.8, 2021/06/02 04:45:09 UTC
I'm guessing the M1 had issues with immerge v1.8? If so, by any chance, will you be bundling immerge v1.9 in the next darwin_arm64 miriad release?
Many thanks,
Simon.
Re: immerge problem, potentially with Apple M1 silicon?
Posted: Wed May 18, 2022 9:59 am
by Mark.Wieringa
Hi Simon,
I've updated the M1 distribution, hopefully that fixes your issue.
Our M1 build is still a bit of a manual process and this must have been forgotten.Apologies for the confusion and extra work.
Cheers,
Mark
Re: immerge problem, potentially with Apple M1 silicon?
Posted: Wed May 18, 2022 7:45 pm
by simonp
Hi Mark,
Many thanks for your time. I can confirm that immerge is now working on my M1 without issue!
Cheers,
Simon.