PtclTableCache

class halotools.sim_manager.PtclTableCache(read_log_from_standard_loc=True, **kwargs)[source]

Bases: object

Object providing a collection of particle catalogs for use with Halotools.

Methods Summary

add_entry_to_cache_log(log_entry[, update_ascii])

determine_log_entry_from_fname(fname[, ...])

Method tries to construct a PtclTableCacheLogEntry using the metadata that may be stored in the input file.

matching_log_entry_generator([dz_tol])

remove_entry_from_cache_log(simname, ...[, ...])

If the log stores an entry matching the input metadata, the entry will be deleted and the ascii file storing the log will be updated.

retrieve_log_from_ascii()

Read '$HOME/.astropy/cache/halotools/ptcl_table_cache_log.txt', clean the log of any repeated entries, sort the log, and return the resulting list of PtclTableCacheLogEntry instances.

update_cached_file_location(new_fname, ...)

update_log_from_current_ascii()

Methods Documentation

add_entry_to_cache_log(log_entry, update_ascii=True)[source]
determine_log_entry_from_fname(fname, overwrite_fname_metadata=False)[source]

Method tries to construct a PtclTableCacheLogEntry using the metadata that may be stored in the input file. An exception will be raised if the determination is not possible.

Parameters:
fnamestring

Name of the file

Returns:
log_entryPtclTableCacheLogEntry instance
matching_log_entry_generator(dz_tol=0.0, **kwargs)[source]
remove_entry_from_cache_log(simname, version_name, redshift, fname, raise_non_existence_exception=True, update_ascii=True, delete_corresponding_ptcl_catalog=False)[source]

If the log stores an entry matching the input metadata, the entry will be deleted and the ascii file storing the log will be updated. If there is no match, an exception will be raised according to the value of the input raise_non_existence_exception.

Parameters:
simnamestring

Nickname of the simulation used as a shorthand way to keep track of the particle catalogs in your cache. The simnames processed by Halotools are ‘bolshoi’, ‘bolplanck’, ‘consuelo’ and ‘multidark’.

version_namestring

Nickname of the version of the particle catalog.

redshiftstring or float

Redshift of the particle catalog, rounded to 4 decimal places.

fnamestring

Name of the hdf5 file storing the table of particles.

raise_non_existence_exceptionbool, optional

If True, an exception will be raised if this function is called and there is no matching entry in the log. Default is True.

delete_corresponding_ptcl_catalogbool, optional

If set to True, when the log entry is deleted, the corresponding hdf5 file will be deleted from your disk. Default is False.

retrieve_log_from_ascii()[source]

Read ‘$HOME/.astropy/cache/halotools/ptcl_table_cache_log.txt’, clean the log of any repeated entries, sort the log, and return the resulting list of PtclTableCacheLogEntry instances.

update_cached_file_location(new_fname, old_fname, **kwargs)[source]
Parameters:
new_fnamestring

Name of the new location of the file

old_fnamestring

Name of the old location of the file

update_log_from_current_ascii()[source]