asc package

Submodules

asc.asc module

asc.cli module

asc.data module

Data module

This module lets the program to download the data from the server.

class asc.data.Data[source]

Bases: object

Data collection.

clear_zip(url_list, tmp_dir)[source]

Clear the archives

Delete the downloaded archives.

Args:
url_list (str): list of strings containing the urls tmp_dir (str): path where are store the archives
download(url_list, dest_dir)[source]

Download data from a list of URLs

Download data from a list of URLs and display a progress according to the size of the file.

Args:
url_list(list): list containing URLs of files to download. dest_dir (str): path to where download the data.
file_to_list(filename)[source]

Parse a file and transform it into a list

Parse a file line by line to make a list with the urls contained inside.

Args:
filename (str): path to the file containing the URLs.
unzip_data(url_list, origin_dir, dest_dir)[source]

Unzip data files

Unzip data files given a list of file names, the path where they are store and where they will be unzipped.

Args:
url_list (str): list of strings containing the urls origin_dir (str): directory where are stored the files dest_dir (str): directory where the files will be extracted

asc.utils module

asc.utils.conf_param_extract(parameter)[source]

Extract the section and option given the parameter.

Extract the section and option given the parameter that is in the specific format section.option

Args:
parameter (str): parameter with the format ‘section.option’
Returns:
The section and option
asc.utils.ms2smp(ms, sample_rate)[source]

Milliseconds to samples converter.

Simple converter in order to compute the number of samples for a given time frame in milliseconds and the sampling rate.

Args:

ms (int): Number of milliseconds. sample_rate (int): Sampling rate in Hertz.
Returns:
Return the number of sample (forced as an int).
asc.utils.read_config(section, option, config_obj)[source]

Look for a given option in a config file.

If exists, return the value in a config file according to the section and option.

Args:
section (str): section related to the option looked for. option (str): option related to the value looked for. config_obj (obj): configparser object.
Returns:
value given for a specific tuple section/option.
Todo:
  • Be able to cast the data into the right type.
asc.utils.write_config(section, option, data, config_obj, config_file)[source]

Write/Update the configuration file

Write or update the configuration file according to the section or option provided.

Args:

section (str): Name of the section option (str): Name of the option data (str): data related to the option to store config_obj (str): instance of the configuration object) config_file (str): instance of the configuration file where to save

the data
Returns:
None
Todo:
Need to cast the object to string before saving the data.

Module contents

Top-level package for Acoustic Scene Classification.