Data access

IceCube has a bunch of public datasets available at https://icecube.wisc.edu/science/data-releases/. icecube_tools provides an easy interface to this repository so that you can download and organise your data through python.

[1]:
from icecube_tools.utils.data import IceCubeData

The IceCubeData class provides this functionality. Upon initialisation, IceCubeData queries the website using HTTP requests to check what datasets are currently available. By default, this request is cached to avoid spamming the IceCube website. However, you can use the keyword argument update to override this.

[2]:
my_data = IceCubeData(update=True)

# The available datasets
my_data.datasets
[2]:
['2021_03-all_data_releases.zip',
 '20080911_AMANDA_7_Year_Data.zip',
 '20090521_IceCube-22_Solar_WIMP_Data.zip',
 '20110905_IceCube-40_String_Data.zip',
 '20131121_Search_for_contained_neutrino_events_at_energies_above_30_TeV_in_2_years_of_data.zip',
 '20150127_IceCube_Oscillations%20_3_years_muon_neutrino_disappearance_data.zip',
 '20150219_Search_for_contained_neutrino_events_at_energies_greater_than_1_TeV_in_2_years_of_data.zip',
 '20150619_IceCube-59%20_Search_for_point_sources_using_muon_events.zip',
 '20150820_Astrophysical_muon_neutrino_flux_in_the_northern_sky_with_2_years_of_IceCube_data.zip',
 '20151021_Observation_of_Astrophysical_Neutrinos_in_Four_Years_of_IceCube_Data.zip',
 '20160105_The_79-string_IceCube_search_for_dark_matter.zip',
 '20160624_Search_for_sterile_neutrinos_with_one_year_of_IceCube_data.zip',
 '20161101_Search_for_point_sources_with_first_year_of_IC86_data.zip',
 '20161115_A_combined_maximum-likelihood_analysis_of_the_astrophysical_neutrino_flux.zip',
 '20180213_Measurement_of_atmospheric_neutrino_oscillations_with_three_years_of_data_from_the_full_sky.zip',
 '20180712_IceCube_catalog_of_alert_events_up_through_IceCube-170922A.zip',
 '20180712_IceCube_data_from_2008_to_2017_related_to_analysis_of_TXS_0506+056.zip',
 '20181018_All-sky_point-source_IceCube_data%20_years_2010-2012.zip',
 '20190515_Three-year_high-statistics_neutrino_oscillation_samples.zip',
 '20190904_Bayesian_posterior_for_IceCube_7-year_point-source_search_with_neutrino-count_statistics.zip',
 '20200227_All-sky_point-source_IceCube_data%20_years_2012-2015.zip',
 '20200421_IceCube_Upgrade_Neutrino_Monte_Carlo_Simulation.zip',
 '20200514_South_Pole_ice_temperature.zip',
 '20210126_PS-IC40-IC86_VII.zip',
 '20210310_IceCube_data_for_the_first_Glashow_resonance_candidate.zip',
 '20211217_HESE-7-5-year-data.zip',
 '20220201_Density_of_GeV_muons_in_air_showers_measured_with_IceTop.zip',
 '20220902_Evidence_for_neutrino_emission_from_the_nearby_active_galaxy_NGC_1068_data.zip',
 '20220913_Evidence_for_neutrino_emission_from_the_nearby_active_galaxy_NGC_1068_data.zip',
 'ic22-solar-wimp-histograms.zip']

You can use the find method to pick out datasets you are interested in.

[3]:
found_dataset = my_data.find("20181018")
found_dataset
[3]:
['20181018_All-sky_point-source_IceCube_data%20_years_2010-2012.zip']

The my_data object has been inititalised to store data in the package’s default location (“~/.icecube_data”). This is where other icecube_tools modules will look for stored data.

[4]:
my_data.data_directory
[4]:
'/home/runner/.icecube_data'

The fetch method will download this dataset to this default location for later use by icecube_tools. This method takes a list of names, so can also be used to download multiple datasets. fetch has a built in delay of a few seconds between HTTP requests to avoid spamming the website. fetch will not overwrite files by default, but this can be forced with overwrite=True.

[5]:
my_data.fetch(found_dataset)
20181018_All-sky_point-source_IceCube_da...: 100%|██████████| 11730609/11730609 [00:02<00:00, 4626017.59it/s]

You may not want to use icecube_tools for other stuff, so you can also fetch to a specificed location with the keyword write_to.

[6]:
my_data.fetch(found_dataset, write_to="data", overwrite=True)
20181018_All-sky_point-source_IceCube_da...: 100%|██████████| 11730609/11730609 [00:10<00:00, 1080808.61it/s]

For convenience, there is also the fetch_all_to method to download all the available data to a specified location. We comment this here as it can take a while to execute.

[7]:
# my_data.fetch_all_to("data")