nwb_project_analytics.dandistats module

Compute DANDI statistics for NWB projects

class nwb_project_analytics.dandistats.DANDIStats

Bases: object

DANDI_NWB_STATS_FILENAME = 'dandi_nwb_stats.tsv'
NEURODATA_TYPE_MAP = {'ecephys': ['LFP', 'Units', 'ElectricalSeries'], 'icephys': ['PatchClampSeries', 'VoltageClampSeries', 'CurrentClampSeries', 'CurrentClampStimulusSeries'], 'ophys': ['PlaneSegmentation', 'TwoPhotonSeries', 'ImageSegmentation']}
SPECIES_REPLACEMENT = {'Bos taurus - Cattle': 'Cattle', 'Brown rat': 'Rat', 'Caenorhabditis elegans': 'C. elegans', 'Canis lupus familiaris - Dog': 'Dog', 'Cricetulus griseus - Cricetulus aureus': 'Chinese hamster', 'Danio rerio - Leopard danio': 'Zebrafish', 'Danio rerio - Zebra fish': 'Zebrafish', 'Drosophila melanogaster - Fruit fly': 'Fruit fly', 'Homo sapiens - Human': 'Human', 'Macaca mulatta - Rhesus monkey': 'Rhesus monkey', 'Macaca nemestrina - Pig-tailed macaque': 'Pig-tailed macaque', 'Macaca nemestrina - Pigtail macaque': 'Pigtail macaque', 'Mus musculus - House mouse': 'House mouse', 'Ooceraea biroi - Clonal raider ant': 'Clonal raider ant', 'Oryctolagus cuniculus - Rabbits': 'Rabbit', 'Rat; norway rat; rats; brown rat': 'Rat', 'Rattus norvegicus - Norway rat': 'Rat'}
static cached(output_dir)

Check if a complete cached version of this class exists at output_dir

classmethod compute_dandi_nwb_stats(cache_dir: str, read_cache: bool = True, write_cache: bool = True, print_status: bool = True)

Compute the NWB statistics for all DANDI datasets

Parameters:
  • cache_dir – Path to the director where the files with the cached results are stored or should be written to

  • read_cache – Bool indicating whether results should be loaded from cache if cached files exists at cache_dir. NOTE: If read_cache is True and files are in the cache then the results will be loaded without checking results (e.g., whether results in the cache are complete and up-to-date).

  • write_cache – Bool indicating whether to write the results to the cache.

  • print_status – Print status of creation (Default=True)

classmethod create_dandistats_pages(out_dir: str, data_dir: str, load_cached_results: bool = True, cache_results: bool = True, print_status: bool = True)

Render all pages and figures related to the DANDI NWB statistics

Parameters:
  • out_dir – Directory where the RST and image files should be saved to

  • data_dir – Directory where the data for the code statistics should be cached

  • load_cached_results – Load code statists from data_dir if available

  • cache_results – Save code statistic results to data_dir

  • print_status – Print status of creation (Default=True)

Check if the dandiset has related publications

static is_nwb(metadata)

Check if the dandiset is a NWB dandiset

static plot_dandiset_size_histogram(dandistats_df: DataFrame, figure_path: str)

Plot histogram of data sizes across NWB dandisets

Parameters:
  • dandistats_df – Datafram with DANDI NWB stats computed by compute_dandi_nwb_stats

  • figure_path – Path where the figure should be saved

static plot_modality_histogram(dandistats_df: DataFrame, figure_path: str)

Plot histogram of modalities ecephys, ophys, icephys distribution across NWB dandisets

Parameters:
  • dandistats_df – Datafram with DANDI NWB stats computed by compute_dandi_nwb_stats

  • figure_path – Path where the figure should be saved

static plot_number_of_dandisets_by_date(dandistats_df: DataFrame, figure_path: str)

Plot curve-plot of the number of DANDI NWB datasets over time

Parameters:
  • dandistats_df – Datafram with DANDI NWB stats computed by compute_dandi_nwb_stats

  • figure_path – Path where the figure should be saved

static plot_number_of_nwbfiles_by_date(dandistats_df: DataFrame, figure_path: str)

Plot curve-plot of the total number of NWB files in DANDI datasets over time

Parameters:
  • dandistats_df – Datafram with DANDI NWB stats computed by compute_dandi_nwb_stats

  • figure_path – Path where the figure should be saved

static plot_size_of_dandisets_by_date(dandistats_df: DataFrame, figure_path: str)

Plot curve-plot of the total size of DANDI NWB datasets over time

Parameters:
  • dandistats_df – Datafram with DANDI NWB stats computed by compute_dandi_nwb_stats

  • figure_path – Path where the figure should be saved

static plot_species_histogram(dandistats_df: DataFrame, figure_path: str)

Plot histogram of species distribution across NWB dandisets

Parameters:
  • dandistats_df – Datafram with DANDI NWB stats computed by compute_dandi_nwb_stats

  • figure_path – Path where the figure should be saved