user29A / CCDLAB

FITS image interaction, world coordinate solving, point source extraction, photometry, etc. See the github Wiki link below for more info. If you require CCDLAB for UVIT, please ensure you have the UVIT Calibration Database which you can find at the CCDLAB Wiki link below.
https://github.com/user29A/CCDLAB/wiki
8 stars 0 forks source link

AstraCarta query returning no data, Remoteserver responds with error 400 #2

Closed EAlexJ closed 1 year ago

EAlexJ commented 1 year ago

As the title say, I am unable to download catalogs using the built-in function.

user29A commented 1 year ago

Usually that happens when the Gaia service is down, or there is no internet connection. It could also happen if the query is not formatted correctly? Ensure that all of the query info is available.

EAlexJ commented 1 year ago

Hello Joe, thank you for responding to all the problems I encountered.

I saw the videos on youtube and even tho things are quite a bit different I went ahead with the file I already shared with you and used the built-in AstraCarta with the following settings:

Catalogue: GaiaDR3
Filter: g
CVAL1(RA): RA the RA value in the header
CVAL2/DEC) : DEC the DEC value in the header
Buffer (arcmin): 10, I asume this is a good value, the picture is roughly 6x6 arcminutes 
I select square region and query for the 2000 brightest Stars
I also select "Show Catalogue Plot" and "Force New Raw Query" and "Save file in image Dir" 
Leaving EPOCH blank or filling in the EQUINOX header keyword or the value does not change the outcome.

Once I double-click AstraCarta in the dropdown menu I get the same error, which reads:

The Remoteserver returned an error: (400) Invalid Request.
System.Net.WebResponse GetResponse()
at System.Net.HttpWebRequest.GetResponse()
at JPFITS.AstraCarta.Query(Double ra, Double dec, Double scale, Int32 pixwidth, Int32 pixheight, ArrayList optArgs)
System

Excuse me for not including this detail in the original posting.

This error persisted today and when I first posted and in the meantime I was able to use the AstraCarta package itself for queries so I dont think the Gaia Service or my internetconnection had issues at any point. If I can give you any more information let me know! -Eyck

user29A commented 1 year ago

The image field size (Wifth & Height) also must be included. See here:

astracarta
EAlexJ commented 1 year ago

Hello Joe, I got to understand CCDLAB quite a bit better, the Youtube Videos were a great ressource for that. This is the query I am starting:

AstraCartaScreenshot

The error is the same as before.

I am using the latest release.

user29A commented 1 year ago

OK I just used the tool via CCDLAB using the exact same settings, and it worked for me.

For you it thinks that it is an invalid request. So somehow the formatting might be different? What OS are you using? I am on Windows 10. Perhaps if you're using bootcamp or something, the string gets sent out differently?

I will see if there is anything I can code in to get more information about why it thinks that it is an invalid request.

EAlexJ commented 1 year ago

I am on a windows machine Running Windows 10 Pro Version 21H2.

user29A commented 1 year ago

OK I just updated the msi installer:

https://github.com/user29A/CCDLAB/releases/download/2023.05.20/CCDLAB.Setup.msi

I put in a catch statement for any exception which occurs on the relevant lines of code - it SHOULD give you a big message when an error occurs full of information. If it does, screenshot it and post it here please. Thanks!

EAlexJ commented 1 year ago

I tried the new installation, I still get the same error at first, but also a second one. image The first line reads that the file could not be found.

user29A commented 1 year ago

Try checking on the "Remove Raw Query" option, and see what happens. Try a couple of times so that the option can fire.

Also, navigate to that directory in the first line and see if the directory exists, and if the file is there, or if any files are there, etc.

Let me know what you find.

It seems to simply not be issuing a valid request and hence does not receive any data back to create a file with. Are you using a VPN which perhaps the server rejects?

But, you can issue AstraCarta via Python command, correct? And that works. But then this does not work. Do you have the latest .Net version? It is coded with .Net 4.8:

https://dotnet.microsoft.com/en-us/download/dotnet-framework/thank-you/net48-offline-installer

See if that helps?

EAlexJ commented 1 year ago

Where as I was running astracarta from a mac before , I now used it on Windows and it works flawlessly. The folder does exist, it is empty however. I also installed the newest dot net version.

I noticed that when using astracarta on the command line, it shows the query that was launched. Is it possible to modify the catch block in a way, so it also displays the query that was launched? Being able to compare them might be a good place to find additional information.

user29A commented 1 year ago

OK I updated the catch to display the job string (query), and also to display whatever content is returned by the server:

https://github.com/user29A/CCDLAB/releases/download/2023.05.20/CCDLAB.Setup.msi

user29A commented 1 year ago

I also copy the job string and the server content automatically to the clipboard, so that characters can be inspected, etc.:

https://github.com/user29A/CCDLAB/releases/download/2023.05.20/CCDLAB.Setup.msi

EAlexJ commented 1 year ago

image The error reads "For the current Thread STA_mode has to be assigned, before OLE-Calls can be executed. Please make sure, that the main funtion is marked with STAThreadAttribute" Judging from the error, copying to clipboard does not work properly.

user29A commented 1 year ago

OK try it again:

https://github.com/user29A/CCDLAB/releases/download/2023.05.20/CCDLAB.Setup.msi

EAlexJ commented 1 year ago

Here you go: image Is this helpful in any way?

user29A commented 1 year ago

Ah...yes, it IS very helpful, and it relates to a comment you made elsewhere, as it relates to your language culture and your OS language settings.

Decimals are 0.0, not to be 0,0.

In English, the '.' means period in language, and in math it means "point". The ',' is a comma and is used only in language, and nowhere in mathematics in the English language culture conventions.

It seems that for your language culture, you use comma, ',' for the decimal point? That seems to be translating through the OS language settings and into the job string.

I am guessing that if you changed your OS language setting to English, then it would work.

The jobstring is created by copying the numeric variables directly into to the string, like this:

jobstr += string.Format("POLYGON('ICRS',{0},{1},{2},{3},{4},{5},{6},{7}))", ra_topleft, dec_topleft, ra_topright, dec_topright, ra_bottomright, dec_bottomright, ra_bottomleft, dec_bottomleft) + Environment.NewLine;

So whereas ra_topleft for me on English language settings would be 359.228527297989, for you it is 359,228527297989, where the period "." has been replaced with ",".

I have changed the code to this:

jobstr += string.Format(CultureInfo.GetCultureInfo("en-US").NumberFormat, "POLYGON('ICRS',{0},{1},{2},{3},{4},{5},{6},{7}))", ra_topleft, dec_topleft, ra_topright, dec_topright, ra_bottomright, dec_bottomright, ra_bottomleft, dec_bottomleft) + Environment.NewLine;

where CultureInfo.GetCultureInfo("en-US").NumberFormat should force the real numbers to be formatted with a "." regardless of which language culture the OS is using.

Let me know if it works now!

https://github.com/user29A/CCDLAB/releases/download/2023.05.20/CCDLAB.Setup.msi

EAlexJ commented 1 year ago

As mentioned in another issue, the solution was to make sure the decimal seperator is a period. This can be changed in the regional windows settings.