Closed bjnorfolk closed 4 years ago
Hey, thanks for trying Galario out!
From the traceback you sent, I can see the problem is not with galario
.
Rather, the issue is due to a clash between matplotlib
and the magic ipython
command %run
.
This is the issue: https://github.com/ipython/ipython/issues/11946
Is it possible you ran ipython
using ipython --matplotlib
?
If so, try running ipython
only.
If it still errors, try running ipython
and then run galario.py
(i.e. without -i
).
If it still errors, I would try by re-installing ipython
and matplotlib
in the python environment that you are using, e.g. with:
conda install --force-reinstall matplotlib ipython
Hi Marco,
Thanks for the reply. I implemented your solutions but still couldn't seem to get the script running in ipython. However, simply running python galario_test.py
avoids the issue.
But I do run into a new issue. I believe it's with the line in my code:
uv = UVTable(uvtable=[u*wle, v*wle, Re, Im, w], wle=wle)
As the call back is
I read in the uv table as follows (u, v, Re, Im, w = np.require(np.loadtxt("uvtable.txt", unpack=True), requirements='C')
had errors, and I believe my u and v values were already in meters)
#Reading table
uv_data = Table.read('vis_files/hd100453_offset_uv_data.txt', format='ascii')
#Setting variables
u = np.require(uv_data['u'], requirements='C')
v = np.require(uv_data['v'], requirements='C')
Re = np.require(uv_data['Re'], requirements='C')
Im = np.require(uv_data['Im'], requirements='C')
w = np.require(uv_data['weights'], requirements='C')
Any tips?
Thanks, Brodie
Hi Brodie,
1) good that python galario_test.py
works fine. I have to say this is the typical usage. Ipython adds lots of additional stuff during runtime to add interactivity, but it typically slows down the code and unsurprisingly causes problems. Just go ahead using python galario_test.py
2) regarding the issue with reading the uv table.
I think the issue is that you need to define what columns format the uvtable uses.
I've introduced COLUMNS format in uvplot 0.2.6 to support more uvtable formats. I apologise for not having updated the galario
quickstart documentation to use that.
See documentation of the COLUMNS formats here: https://github.com/mtazzari/uvplot#1-plotting-visibilities
To fix the issue you need to make sure you have uvplot 0.2.6 or more recent install, then add on top of the code snippet:
from uvplot import COLUMNS_V0
and then you can read the uvtable as:
uv = UVTable(filename="...", columns=COLUMNS_V0, format='ascii')
where I am suggesting format='ascii'
because I guess your uvtable is ASCII, right?
The uvtable can alternatively be in binary format (.npz file). You can see full documentation in the UVTable docstring
Then you can go on reading the columns as
u = uv.u
v = uv.v
Re = uv.re
Im = uv.im
w = uv.weights
(note the lower case for uv.re
and uv.im
attributes.)
Alternatively, you can just replace u, v
, etc, in the code to directly use uv.u, uv.v
, etc.
The UVTable object ensures that its arrays (uv.u
, etc.) are C contiguous, so you are safe.
Hope this helps
Hi Marco, Thanks for the reply, I removed my previous posts as I figured out the issue.
uv_mod = UVTable(filename='tutorial_mod.txt', wle=wle, columns=COLUMNS_V0)
This syntax worked for me, thanks for all your help.
:+1: for such much support @mtazzari
Hi, I'm going through the quickstart guide and I receive the error: AttributeError: 'function' object has no attribute 'called'
Any tips to solve this?
Thanks!