Closed jpbrandtu closed 3 months ago
Hello and thanks for opening this issue here :slightly_smiling_face:
The function add_table only works to modify an existing widget. It should be called after the cell containing ipyaladin and the table appears in the above cell. See here :
(I clicked on the point to highlight it)
Does this answer your question? Or did I get you wrong?
Hi, Is it ok with you if I close this issue? We will keep that in mind when writing the documentation :slightly_smiling_face:
Hi @ManonMarchand,
Thanks for the reply! Is it therefore mandatory to use functions like add_table in a separate cell? I ask because until recently (maybe a month ago) I was able to run code like this from a separate library (thus everything was in a single cell) but now such code works only sometimes. For instance, sometimes when I set the aladin.target the widget is updated to the object coordinates, but other times it seems to ignore the command and only shows coordinates (0,0). Same happens to me with add_table, sometimes it shows the symbols and others it doesn't. Did something change recently?
If it helps, I include the code versions I'm using:
astropy==5.2.2 astropy-healpix==0.6 ipyaladin==0.2.1 ipykernel==6.22.0 ipython==8.12.0 jupyter==1.0.0 jupyter-console==6.6.3
Thanks in advance!
Aaaah yes, indeed.
What we do internally is that we have a listener that adds the table to the widget when the boolean table_flag
changes.
With this, it can happen that if you do everything in the same cell, the aladin view or the listener does not exist yet when the table is called. It seems to be a computer-dependent issue. A workaround is to call
aladin.table_flag = not aladin.table_flag
in a next cell, but I'm aware that it does not solve your use case, very sorry :frowning:
Changing this behaviour requires some refactoring and won't be done right now (we're quite busy for the next 2 months) but I opened an issue for the v1 release #63
Thanks @ManonMarchand! I added some time.sleep(2)
's in between commands and that seems to help in my case
Hi @jpbrandtu - we recently changed ipyaladin for using anywidget. We will test it to see if things are getting better (I suppose this is because aladin lite instanciation is done async and maybe anywidget fix those types of errors). To be further tested.
Hi,
I am using Aladin widget in Python to show SN coordinates, but it does not work properly (the symbol indicating the coordinates does not appear, even when I provide them in the add_table function). This is the code:
And this is the output: