ctaplot/io/dataset.py
def find_resource(resource_name):
    """
    Find a resource in the share directory

    Parameters
    ----------
    resource_name: str
        name of a file to find

    Returns
    -------
    str - absolute path to the resource
    """
    # If ctaplot is installed via python setup.py develop, data files stay in share
    share_dir = os.path.join(pkg_resources.resource_filename('ctaplot', ''), '../share/')
    gammaboard_dir = os.path.join(pkg_resources.resource_filename('ctaplot', ''), 'gammaboard/')
    resources_dirs = [share_dir, gammaboard_dir]
    for res_dir in resources_dirs:
        for root, dirs, files in os.walk(res_dir):
            if resource_name in files:
                return os.path.abspath(os.path.join(root, resource_name))

    # If ctaplot is installed via pip install, data files are copied in <sys.prefix>/ctaplot
    sys_dir = os.path.join(sys.prefix, 'ctaplot')
    if not os.path.exists(os.path.join(sys_dir, resource_name)):
        raise FileNotFoundError("Couldn't find resource: '{}'".format(resource_name))
    else:
        return os.path.join(sys_dir, resource_name)

    Find a resource in the share directory

    Parameters
    ----------
    resource_name: str
        name of a file to find

    Returns
    -------
    str - absolute path to the resource
    
Find a resource in the share directory
Parameters

str
name of a file to find

Returns

absolute path to the resource
Find a resource in the share directory Parameters str name of a file to find Returns absolute path to the resource
def find_resource(resource_name):
    share_dir = os.path.join(pkg_resources.resource_filename('ctaplot', ''), '../share/')
    gammaboard_dir = os.path.join(pkg_resources.resource_filename('ctaplot', ''), 'gammaboard/')
    resources_dirs = [share_dir, gammaboard_dir]
    for res_dir in resources_dirs:
        for root, dirs, files in os.walk(res_dir):
            if resource_name in files:
                return os.path.abspath(os.path.join(root, resource_name))
    sys_dir = os.path.join(sys.prefix, 'ctaplot')
    if not os.path.exists(os.path.join(sys_dir, resource_name)):
        raise FileNotFoundError("Couldn't find resource: '{}'".format(resource_name))
    else:
        return os.path.join(sys_dir, resource_name)
def find_resource ( resource_name ) : share_dir = os . path . join ( pkg_resources . resource_filename ( 'ctaplot' , '' ) , '../share/' ) gammaboard_dir = os . path . join ( pkg_resources . resource_filename ( 'ctaplot' , '' ) , 'gammaboard/' ) resources_dirs = [ share_dir , gammaboard_dir ] for res_dir in resources_dirs : for root , dirs , files in os . walk ( res_dir ) : if resource_name in files : return os . path . abspath ( os . path . join ( root , resource_name ) ) sys_dir = os . path . join ( sys . prefix , 'ctaplot' ) if not os . path . exists ( os . path . join ( sys_dir , resource_name ) ) : raise FileNotFoundError ( "Couldn't find resource: '{}'" . format ( resource_name ) ) else : return os . path . join ( sys_dir , resource_name )
Find a resource in the share directory
Parameters
Find a resource in the share directory Parameters
"""
    Find a resource in the share directory

    Parameters
    ----------
    resource_name: str
        name of a file to find

    Returns
    -------
    str - absolute path to the resource
    """ # If ctaplot is installed via python setup.py develop, data files stay in share # If ctaplot is installed via pip install, data files are copied in <sys.prefix>/ctaplot
resource_name