def bo_api_save_ophys():
    bo = BrainObservatoryApi('http://testwarehouse:9000')
    bo.json_msg_query = \
        MagicMock(name='json_msg_query',
                  return_value=[{'download_link': '/url/path/to/file'}])

    return bo
 def __init__(self,
              cache=True,
              manifest_file='brain_observatory_manifest.json',
              base_uri=None):
     super(BrainObservatoryCache, self).__init__(manifest=manifest_file,
                                                 cache=cache)
     self.api = BrainObservatoryApi(base_uri=base_uri)
Beispiel #3
0
def cell_specimen_table(md_temp_dir):
    # download a zipped version of the cell specimen table for filter tests
    # as it is orders of magnitude faster
    api = BrainObservatoryApi()
    zipped = os.path.join(md_temp_dir, "cell_specimens.zip")
    api.retrieve_file_over_http(CELL_SPECIMEN_ZIP_URL, zipped)
    df = pd.read_csv(ZipFile(zipped).open("cell_metrics.csv"),
                     true_values="t", false_values="f")
    js = json.loads(df.to_json(orient="records"))
    table_file = os.path.join(md_temp_dir, "cell_specimens.json")
    with open(table_file, "w") as f:
        json.dump(js, f, indent=1)
    return table_file
    def __init__(self,
                 cache=True,
                 manifest_file='brain_observatory_manifest.json',
                 base_uri=None,
                 api=None):
        super(BrainObservatoryCache,
              self).__init__(manifest=manifest_file,
                             cache=cache,
                             version=self.MANIFEST_VERSION)

        if api is None:
            self.api = BrainObservatoryApi(base_uri=base_uri)
        else:
            self.api = api
    def __init__(self,
                 cache=True,
                 manifest_file=None,
                 base_uri=None,
                 api=None):

        if manifest_file is None:
            manifest_file = get_default_manifest_file('brain_observatory')

        super(BrainObservatoryCache,
              self).__init__(manifest=manifest_file,
                             cache=cache,
                             version=self.MANIFEST_VERSION)

        if api is None:
            self.api = BrainObservatoryApi(base_uri=base_uri)
        else:
            self.api = api
def bo_api():
    bo = BrainObservatoryApi('http://testwarehouse:9000')
    bo.json_msg_query = MagicMock(name='json_msg_query')

    return bo
Beispiel #7
0
def api():
    boi = BrainObservatoryApi()

    return boi
Beispiel #8
0
def bo_api():
    endpoint = os.environ[
        'TEST_API_ENDPOINT'] if 'TEST_API_ENDPOINT' in os.environ else 'http://twarehouse-backup'
    return BrainObservatoryApi(endpoint)
def make_bo_api():
    from allensdk.api.queries.brain_observatory_api import BrainObservatoryApi

    endpoint = os.environ['TEST_API_ENDPOINT'] if 'TEST_API_ENDPOINT' in os.environ else 'http://twarehouse-backup'
    return BrainObservatoryApi(endpoint)