コード例 #1
0
def download_dandiset_assets(dandiset_id="000037",
                             version="draft",
                             output=".",
                             incl_stim_templates=False,
                             incl_full_stacks=False,
                             sess_ns="all",
                             mouse_ns="all",
                             excluded_sess=True,
                             mouse_df=DEFAULT_MOUSE_DF_PATH,
                             log_level="info"):

    logger_util.format_all(level=log_level)

    dandiset_id = f"{int(dandiset_id):06}"  # ensure correct ID formatting

    asset_sessids = "all"
    if sess_ns not in ["all", "any"] or mouse_ns not in ["all", "any"]:
        if dandiset_id != "000037":
            raise NotImplementedError(
                "Selecting assets based on session and mouse numbers is only "
                "implemented for dandiset 000037.")
        sess_ns = reformat_n(sess_ns)
        mouse_ns = reformat_n(mouse_ns)
        pass_fail = "all" if excluded_sess else "P"
        asset_sessids = sess_gen_util.get_sess_vals(mouse_df,
                                                    "dandi_session_id",
                                                    mouse_n=mouse_ns,
                                                    sess_n=sess_ns,
                                                    runtype="prod",
                                                    pass_fail=pass_fail,
                                                    incl="all",
                                                    sort=True)

    logger.info("Identifying the URLs of dandi assets to download...")
    dandiset_urls = get_dandiset_asset_urls(
        dandiset_id,
        version=version,
        asset_sessids=asset_sessids,
        incl_stim_templates=incl_stim_templates,
        incl_full_stacks=incl_full_stacks)

    logger.info(f"Downloading {len(dandiset_urls)} assets from "
                f"dandiset {dandiset_id}...")

    for dandiset_url in dandiset_urls:
        dandi_download.download(dandiset_url, output, existing="refresh")
コード例 #2
0
                        action="store_true",
                        help="create a datetime folder")
    parser.add_argument("--overwrite",
                        action="store_true",
                        help="allow overwriting")
    parser.add_argument("--not_save_fig",
                        action="store_true",
                        help="don't save figures")
    parser.add_argument("--no_sharey",
                        action="store_true",
                        help="don't share y axis")
    # plot using modif_analys_plots (if plotting from dictionary)
    parser.add_argument(
        "--modif",
        action="store_true",
        help=("plot from dictionary using modified plot functions"))

    args = parser.parse_args()

    return args


#############################################
if __name__ == "__main__":

    args = parse_args()

    logger_util.format_all(level=args.log_level)

    main(args)