-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read uploaded file with astrojsvis and use it in photoz widget #262
Comments
@burnout87 as discussed by email changes have been pushed to https://github.com/esg-epfl-apc/fits-reader For reference : Basically you get a FITSFile object that has an array member called 'hdus' that contains all the file hdus, the fits reader wrapper added methods that let you more easily access the header and data part of each hdu but you won't be needing it now that everything has been moved directly to the FITSFile class. The FITSFile class has a method getHDU(index) that will return the hdu object at the specified index in the hdus array. All the other methods use the index to let you specify which hdu you want to interact with. You can use getHDUs() to get an array of json object describing all hdus etc..... Each hdu object has two object members header and data. There are library methods that you can call from these objects : get("card_name") on a header object will get you the value for that specific card getColumn(column_name, callback) on a table or bintable hdu data object will return the column data Volodymyr said that you were using the same types of data I'm using (Table and Bintable) so for these kinds of hdu the hdu object data member should have a 'columns' array property that gives you the name of each column that you can use with getColumn to get the data. I made a few functions that you call directly from the FITSFile object that do that for you : getHeaderCardValueByNameFromHDU(hdu_index, card_name) getHeaderCardsValueFromHDU(hdu_index) getColumnsJSONDataFromHDU(hdu_index) |
thanks a lot @francoismg , I will try and let you know |
hi again @francoismg , I just tried your code, and I am not sure I am doing everything correctly: this is the code I am using: basically, in the frontend I have a file input, once the file is selected, the
|
hello, is that the file you are trying to fetch http://localhost/mmoda/spiacs_lc_query.fits ? Given that it's an url I assume you have some kind of custom file select where the user choose a remote file and then you try to fetch it with its url is that it? If that's the case it should work I just tested it locally with that http://localhost:7100/_test_files/spiacs_lc_query.fits and it was working. I will need to make more tests on my own and get back to you Just in case if it's a standard file input where you choose a local file I do it like that
|
thanks @francoismg , it works. Only change I had to was the following: // let hdu = fits_file.getHDU(hdu_index);
let hdu = fits_file.hdus[hdu_index]; as the call to the function Error reading file as ArrayBuffer: TypeError: this.file is undefined
value http://localhost/mmoda/sites/all/modules/mmoda/instruments/mmoda_photoz_euclid/js/fits-reader/dist/fits-reader/fits-reader.js?sepek4:1
readFile http://localhost/mmoda/sites/all/modules/mmoda/instruments/mmoda_photoz_euclid/js/mmoda_euclid.js?sepek4:21
commonReady http://localhost/mmoda/sites/all/modules/mmoda/instruments/mmoda_photoz_euclid/js/mmoda_euclid.js?sepek4:44
promise callback*commonReady/< http://localhost/mmoda/sites/all/modules/mmoda/instruments/mmoda_photoz_euclid/js/mmoda_euclid.js?sepek4:43
commonReady http://localhost/mmoda/sites/all/modules/mmoda/instruments/mmoda_photoz_euclid/js/mmoda_euclid.js?sepek4:41 am I perhaps missing some import? |
And yes, it's a standard file input |
ok yea that's my bad, should be fixed now the updated lib has been pushed |
just checked, I confirm it works, thanks |
@burnout87 can ask @francoismg
The text was updated successfully, but these errors were encountered: