EMPIARreader module reference#

The EMPIAR catalog and datasource classes#

class empiarreader.empiar.empiar.EmpiarCatalog(*args, **kwargs)#

Catalog for the EMPIAR entries

Parameters:

empiar_index – Index for the dataset in the archive.

classmethod fetch_entry_data(empiar_index)#

Requests the data from the entry according to the EMPIAR index.

class empiarreader.empiar.empiar.EmpiarSource(*args, **kwargs)#

General EMPIAR intake driver, as DataSource.

Parameters:
  • empiar_index – EMPIAR entry number

  • directory – directory for the relevant files, within the EMPIAR entry

  • driver – type of intake driver needed for the data (mrc, starfile or … any image)

  • filename – [Optional] Name for a specific file to download

  • regexp – [Optional] Name for a specific file type to download

  • imageset_metadata – [Optional] Metadata relative to the specific … imageset needed

  • metadata – [Optional] Metadata relative to the entry

  • storage_options – [Optional] Option to save the data, or cache

property data_directory_url#

Retrieve the current selected data directory for the dataset.

read()#

Reads the DataSource according to the metadata.

read_partition(i)#

“ Reads an individual element of the dataset.

Parameters:

i (int) – Position of the element in the dataset

to_dask()#

Lazily read the DataSource according to the metadata, using Dask.

Intake drivers#

class empiarreader.intake_source.mrcsource.MrcSource(*args, **kwargs)#

Intake driver for mrcfiles as DataSource.

Parameters:

urlpath – URL for the mrcfile.

read()#

Load entire dataset into a container and return it

to_dask()#

Return a dask container for this data source

class empiarreader.intake_source.starsource.StarSource(*args, **kwargs)#

Intake driver for starfiles as DataSource.

Parameters:

urlpath – URL for the starfile.

read()#

Load entire dataset into a container and return it

Utilities#

Download a list of files from EMPIAR via FTP or HTTP empiarreader download –download my_search.txt –save_dir EMPIAR_files –verbose

empiarreader.utilities.download.add_arguments(parser)#

Set out the arguments for the download utility

Parameters:

parser (argparse.ArgumentParser) – argument parser

Returns:

argument parser

Return type:

argparse.ArgumentParser

empiarreader.utilities.download.get_name()#

Name the download utility

Returns:

utility name

Return type:

str

empiarreader.utilities.download.main(args)#

Download EMPIAR files from a list of HTTPS paths in a text file

Parameters:

args (argparse.ArgumentParser) – argument parser with parsed args

Searches EMPIAR to return HTTPS filepaths of files empiarreader search –entry 10934 –select “*.xml” –save_search my_search.txt Use –verbose to make the output more user friendly

empiarreader.utilities.search.add_arguments(parser)#

Set out the arguments for the search utility

Parameters:

parser (argparse.ArgumentParser) – argument parser

Returns:

argument parser

Return type:

argparse.ArgumentParser

empiarreader.utilities.search.get_name()#

Name the search utility

Returns:

utility name

Return type:

str

empiarreader.utilities.search.main(args)#

Search a directory in an EMPIAR entry for files and optionally write HTTPS paths to a file ready for download utility/other use

Parameters:

args (argparse.ArgumentParser) – argument parser with parsed args

Command line usage#

CLI for empiarreader

empiarreader.cli.main()#

Running the CLI functions for EMPIARreader, parses the command line arguments.