immerge problem, potentially with Apple M1 silicon?

Is MIRIAD being a pain? Let us know your experience.

Moderator: Mark.Wieringa

Post Reply
simonp
Posts: 5
Joined: Fri May 06, 2022 2:20 am

immerge problem, potentially with Apple M1 silicon?

Post 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):

Image

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:

Image

Any ideas what may/may not be happening? Apologies if I haven't included any information.
Mark.Wieringa
ATCA Expert
Posts: 297
Joined: Mon Feb 08, 2010 1:37 pm

Re: immerge problem, potentially with Apple M1 silicon?

Post 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
simonp
Posts: 5
Joined: Fri May 06, 2022 2:20 am

Re: immerge problem, potentially with Apple M1 silicon?

Post by simonp »

Hi Mark,

Thanks for the reply. I can confirm that I was using the 'miriad-darwin_arm64' version,

Cheers,

Simon.
simonp
Posts: 5
Joined: Fri May 06, 2022 2:20 am

Re: immerge problem, potentially with Apple M1 silicon?

Post 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
immerged_ifft.png (145.15 KiB) Viewed 25943 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
immerged.png (203.17 KiB) Viewed 25943 times
Mark.Wieringa
ATCA Expert
Posts: 297
Joined: Mon Feb 08, 2010 1:37 pm

Re: immerge problem, potentially with Apple M1 silicon?

Post 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
Mark.Wieringa
ATCA Expert
Posts: 297
Joined: Mon Feb 08, 2010 1:37 pm

Re: immerge problem, potentially with Apple M1 silicon?

Post 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
simonp
Posts: 5
Joined: Fri May 06, 2022 2:20 am

Re: immerge problem, potentially with Apple M1 silicon?

Post 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.
Mark.Wieringa
ATCA Expert
Posts: 297
Joined: Mon Feb 08, 2010 1:37 pm

Re: immerge problem, potentially with Apple M1 silicon?

Post 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
simonp
Posts: 5
Joined: Fri May 06, 2022 2:20 am

Re: immerge problem, potentially with Apple M1 silicon?

Post by simonp »

Hi Mark,

Many thanks for your time. I can confirm that immerge is now working on my M1 without issue!

Cheers,

Simon.
Post Reply