Example datasets

Functions:

download_city_bike([source, years])

Download bike data from the bike sharing system in Oslo.

load_aminoacids([save_data])

Load the Aminoacids dataset from "PARAFAC.

load_oslo_city_bike()

Download bike data from the bike sharing system in Oslo 2020-2021.

tlviz.data.download_city_bike(source='oslobysykkel.no', years=(2020, 2021))[source]

Download bike data from the bike sharing system in Oslo.

The dataset is a five-way tensor with modes:

  • Bike station id

  • Year

  • Month

  • Day of week

  • Hour of day

where the elements corresponds to the number of trips ending in a given time period and station. For example, the index 377, 2020, 5, 1, 13 corresponds to the number of trips that ended at station 377 at 1pm (CET time) on Mondays in May of 2020.

The data was collected using the open urbansharing API.

Parameters:
sourcestr

String to download data from. The API endpoint becomes: https://data.urbansharing.com/{source}/trips/v1/{year}/{month:02d}.csv Some end-points that are known to work are:

  • oslobysykkel.no

  • bergenbysykkel.no

  • trondheimbysykkel.no

yearsiterable of int

The years to download data from.

Returns:
xarray.DataArray

Data array whose data is the dataset and coordinates are bike station ID, year, month, day of week and hour of day. There are also three metadata-coordinates along the “Bike station ID”-axis containing latitudes, longitudes and station names.

tlviz.data.load_aminoacids(save_data=True)[source]

Load the Aminoacids dataset from “PARAFAC. Tutorial and applications” by Rasmus Bro [Bro97].

This is a fluoresence spectroscopy dataset well suited for PARAFAC analysis. The data stems from five samples with different amounts of the aminoacids tyrosine, tryptophan and phenylalanine.

See here for more information about the data:

https://web.archive.org/web/20210413050155/http://models.life.ku.dk/Amino_Acid_fluo

Parameters:
save_databool (default=True)

If True, then the dataset is saved in tlviz.data.DOWNLOAD_PARENT to avoid having to download it in the future.

Returns:
xarray.DataArray

The Aminoacids dataset

tlviz.data.load_oslo_city_bike()[source]

Download bike data from the bike sharing system in Oslo 2020-2021.

The dataset is a five-way tensor with modes:

  • Bike station id

  • Year

  • Month

  • Day of week

  • Hour of day

where the elements corresponds to the number of trips ending in a given time period and station. For example, the index 377, 2020, 5, 1, 13 corresponds to the number of trips that ended at station 377 at 1pm (CET time) on Mondays in May of 2020.

The data was collected using the open API of https://oslobysykkel.no/en/open-data.

Returns:
xarray.DataArray

Data array whose data is the dataset and coordinates are bike station ID, year, month, day of week and hour of day. There are also three metadata-coordinates along the “Bike station ID”-axis containing latitudes, longitudes and station names.