Hi Elimboto,
You typically can't feed URLs into functions that expect local file names,
try something like
import h5py
import healpy
import urllib.request
urllib.request.urlretrieve('
https://github.com/TSSFL/cosmo_datasets/tree/master/hdf5_data.h5',
'hdf5_data.h5')
urllib.request.urlretrieve('
https://github.com/TSSFL/cosmo_datasets/blob/main/avgmap_nside512_f1250.00MHz.fits',
'avgmap_nside512_f1250.00MHz.fits')
f1 = h5py.File('./hdf5_data.h5', 'r')
f2 = maps = healpy.fitsfunc.read_map('avgmap_nside512_f1250.00MHz.fits',
field=0)
Both commands still fail for me, but now because of some issues with files
(perhaps some accompanying files are missing) rather than not being able to
find them.
Best,
Andrey
On Tue, Dec 15, 2020 at 11:16 AM Elimboto Yohana <[email protected]> wrote:
> Hi Andrey,
>
> How do I read the following files on Github in Sage Cell?
>
> 1. https://github.com/TSSFL/cosmo_datasets/tree/master/hdf5_data.h5
> 2.
> https://github.com/TSSFL/cosmo_datasets/blob/main/avgmap_nside512_f1250.00MHz.fits
>
> They respectively require h5py and healpy packages to read them, so
> locally I would import the libraries and read them as follows:
>
> import h5py
>
> f1 = h5py.File('..../hdf5_data.h5', 'r') #... stands for path to the file
>
> import healpy as hp
>
> f2 = hp.fitsfunc.read_map('..../avgmap_nside512_f1250.00MHz.fits', field=0)
>
> I tried
>
> f1 = h5py.File('
> https://github.com/TSSFL/cosmo_datasets/tree/master/hdf5_data.h5', 'r')
> f2 = maps = hp.fitsfunc.read_map('
> https://github.com/TSSFL/cosmo_datasets/blob/main/avgmap_nside512_f1250.00MHz.fits',
> field=0)
>
> on Sage Cell but failed, I get some errors.
>
> Kind regards,
>
> Elimboto
>
> On Tue, Dec 15, 2020 at 4:21 AM Elimboto Yohana <[email protected]> wrote:
>
>> Pandas works great, but so far I have tested pandas with .csv data files.
>> I will test reading other data files such as .fits, .h5 and so on.
>>
>> Thank you,
>>
>> Elimboto
>>
>> On Tuesday, December 15, 2020, Andrey Novoseltsev <[email protected]>
>> wrote:
>> > You have internet access from SageCell, so you definitely can read data
>> from GitHub - as far as for interpreting and parsing them it depends on
>> what you want and need to process them. I think panda is installed, so your
>> code should work - does it not? If something else needs to be installed -
>> let me know!
>> > On Mon, Dec 14, 2020 at 12:05 PM Elimboto Yohana <[email protected]> wrote:
>> >>
>> >> Thank you, Andrey,
>> >> I will let you know If I encounter any issues. There are some
>> warnings, but they don't cause any harm so far. I also hope the available
>> dependencies suffice for current use.
>> >>
>> >> I do not know why my messages do not appear in the Google group, I
>> have actually been replying to both your email and the google group!
>> >> One thing I would like to ask, If I have some astronomical data on a
>> public repository such as GitHub, say the data is in .fits, or .h5 (HDF5)
>> formats, can the data in these file formats be read by parsing the repo
>> URL? Or how can this be done? Is there a limitation for some data formats?
>> >>
>> >> For example, using pandas we can read .csv data file on GitHub as
>> >> df = pd.read_csv("
>> https://github.com/selva86/datasets/raw/master/mtcars.csv")
>> >> Kind regards,
>> >> Elimboto
>> >>
>> >>
>> >> On Mon, Dec 14, 2020 at 7:37 PM Andrey Novoseltsev <[email protected]>
>> wrote:
>> >>>
>> >>> Hi Elimboto!
>> >>> If there are cases when they don't work because of some missing
>> optional dependencies, I'll be happy to install those as well!
>> >>> I am also a bit puzzled why your messages do not show up in the
>> google group - as far as I can tell you are allowed to post and there are
>> no messages in moderation.
>> >>> Best,
>> >>> Andrey
>> >>>
>> >>> --
>> >>> You received this message because you are subscribed to the Google
>> Groups "sage-cell" group.
>> >>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to [email protected].
>> >>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sage-cell/CAD0_dC5qDkhMuMmZj5E%3DvsHiTvnnqvq2Nw637GH8BeMWtrW_%2Bw%40mail.gmail.com
>> .
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "sage-cell" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to [email protected].
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sage-cell/CAD0_dC65mDrsVEyZUEf%2BNyB7q%2BUTKor0oiC9TAHbnfTGvadftg%40mail.gmail.com
>> .
>> >
>
>
--
You received this message because you are subscribed to the Google Groups
"sage-cell" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-cell/CAD0_dC7eJ0%3DA64%2BUZZoyx0jcHRk1GsXxc%2BhcHZRkNtQEHkYrDg%40mail.gmail.com.