def read_args(argv=None): parser = su.add_default_args() parser.add_argument('-t', '--type', help='connection type', required=False, default='') parser.add_argument('--threshold', help='connection threshold', required=False, default=0, type=int) args = su.parse_args(parser, argv) rois_file_exist = op.isfile(op.join(su.get_mmvt_dir(), args.subject, 'rois_con.npz')) electrodes_file_exist = op.isfile(op.join(su.get_mmvt_dir(), args.subject, 'electrodes_con.npz')) if args.type == '': if rois_file_exist and electrodes_file_exist: raise Exception('More than one connection file exist, please select one using the -t flag') elif rois_file_exist: args.type = 'rois' elif electrodes_file_exist: args.type = 'electrodes' else: raise Exception('No connection file was found!\n'+ 'ROIs connection file: rois_con.npz\n' + 'Electrodes connection file: electrodes_con.npz') elif args.type == 'rois': if not rois_file_exist: raise Exception('You chose ROIs connection, but the file rois_con.npz does not exist!') elif args.type == 'electrodes': if not electrodes_file_exist: raise Exception('You chose electrodes connection, but the file electrodes_con.npz does not exist!') return args
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('--python_cmd', help='python cmd', required=False, default=sys.executable) return su.Bag(au.parse_parser(parser, argv))
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('--stat', help='conds stat', required=False, default=STAT_DIFF) return su.parse_args(parser, argv)
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('-r', '--radius', help='radius', required=False, default=0.15, type=float) parser.add_argument('-p', '--pos_file', help='position file', required=False, default='', type=su.str_arr_type) args = su.parse_args(parser, argv) if len(args.subjects) == 0: args.subjects = [args.subject] if len(args.pos_file) == 0: args.pos_file = [''] * len(args.subjects) pos_files = [] for subject, pos_file in zip(args.subjects, args.pos_file): args.subject = subject pos_files_fol = op.join(su.get_mmvt_dir(), args.subject, 'electrodes') if pos_file == '': pos_file_options = glob.glob(op.join(pos_files_fol, 'electrodes*positions*.npz')) if args.bipolar: pos_file_options = [fname for fname in pos_file_options if 'bipolar' in fname] else: pos_file_options = [fname for fname in pos_file_options if 'bipolar' not in fname] if len(pos_file_options) == 0: raise Exception('No electrodes position files in {}!'.format(pos_files_fol)) elif len(pos_file_options) == 1: pos_file = pos_file_options[0] print('electrodes file: {}'.format(pos_file)) else: raise Exception('More than one electrodes positions files in {}'.format(pos_files_fol) + 'please indicate which one using the -p flag') pos_files.append(pos_file) args.pos_file = pos_files if len(args.pos_file) == 1: args.pos_file = args.pos_file[0] return args
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('-o', '--output_path', help='output path', required=False, default='') parser.add_argument('-i', '--image_name', help='image name', required=False, default='') parser.add_argument('-q', '--quality', help='render quality', required=False, default=60, type=int) parser.add_argument('--smooth_figure', help='smooth figure', required=False, default=False, type=su.is_true) parser.add_argument('--hide_lh', help='hide left hemi', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--hide_rh', help='hide right hemi', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--hide_subs', help='hide sub corticals', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--show_elecs', help='show electrodes', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--show_only_lead', help='show only current lead', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--curr_elec', help='current electrode', required=False, default='') parser.add_argument('--show_connections', help='show connections', required=False, default=None, type=su.is_true_or_none) return su.parse_args(parser, argv)
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('-r', '--radius', help='radius', required=False, default=0.15, type=float) parser.add_argument('-p', '--pos_file', help='position file', required=False, default='', type=su.str_arr_type) args = su.parse_args(parser, argv) if len(args.subjects) == 0: args.subjects = [args.subject] if len(args.pos_file) == 0: args.pos_file = [''] * len(args.subjects) pos_files = [] for subject, pos_file in zip(args.subjects, args.pos_file): args.subject = subject pos_files_fol = op.join(su.get_mmvt_dir(), args.subject, 'electrodes') if pos_file == '': pos_file_template = op.join(pos_files_fol, 'electrodes*positions*.npz') pos_file_options = glob.glob(pos_file_template) if args.bipolar: pos_file_options = [ fname for fname in pos_file_options if 'bipolar' in fname ] else: pos_file_options = [ fname for fname in pos_file_options if 'bipolar' not in fname ] if len(pos_file_options) == 0: raise Exception( 'No electrodes position files ({}) in {}!'.format( op.join(pos_files_fol, 'electrodes*positions*.npz'), pos_files_fol)) elif len(pos_file_options) == 1: pos_file = pos_file_options[0] print('electrodes file: {}'.format(pos_file)) else: pos_file = su.select_one_file(pos_file_options, pos_file_template, 'electrodes positions files') else: pos_file = op.join(pos_files_fol, '{}.npz'.format(su.namebase(pos_file))) if not op.isfile(pos_file): raise ("Can't find pos file! {}".format(pos_file)) pos_files.append(pos_file) args.pos_file = pos_files if len(args.pos_file) == 1: args.pos_file = args.pos_file[0] return args
def read_args(argv=None): parser = su.add_default_args() # Add more args here parser.add_argument('--script_name', required=True) parser.add_argument('--script_params', required=False, default='', type=su.str_arr_type) return su.parse_args(parser, argv)
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('-b', '--bipolar', help='bipolar', required=True, type=su.is_true) parser.add_argument('-q', '--quality', help='render quality', required=False, default=60, type=int) parser.add_argument('--labeling', help="electrodes' labeling file name", required=False) parser.add_argument('--output_path', help='output path', required=False, default='electrodes_labeling') parser.add_argument('--rel_output_path', help='relative output path', required=False, default=True, type=su.is_true) parser.add_argument('--smooth_figure', help='smooth figure', required=False, default=False, type=su.is_true) parser.add_argument('--hide_lh', help='hide left hemi', required=False, default=False, type=su.is_true) parser.add_argument('--hide_rh', help='hide right hemi', required=False, default=False, type=su.is_true) parser.add_argument('--hide_subs', help='hide sub corticals', required=False, default=False, type=su.is_true) return su.parse_args(parser, argv)
def read_args(argv=None, raise_exp=True): parser = su.add_default_args() # Add more args here # print('argv: {}'.format(sys.argv)) if raise_exp: return su.parse_args(parser, argv, raise_exception_if_subject_is_empty=False) else: try: args = su.parse_args(parser, argv, raise_exception_if_subject_is_empty=False) except: args = None return args
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('-o', '--output_path', help='output path', required=False, default='') parser.add_argument('-i', '--image_name', help='image name', required=False, default='') parser.add_argument('-q', '--quality', help='render quality', required=False, default=60, type=int) parser.add_argument('--smooth_figure', help='smooth figure', required=False, default=False, type=su.is_true) parser.add_argument('--hide_lh', help='hide left hemi', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--hide_rh', help='hide right hemi', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--hide_subs', help='hide sub corticals', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--show_elecs', help='show electrodes', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--show_only_lead', help='show only current lead', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--curr_elec', help='current electrode', required=False, default='') return su.parse_args(parser, argv)
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('--overwrite_blend', help='', required=False, default=0, type=su.is_true) parser.add_argument('--import_in_blender', help='', required=False, default=0, type=su.is_true) return su.parse_args(parser, argv)
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('-r', '--radius', help='radius', required=False, default=0.15, type=float) parser.add_argument('-p', '--pos_file', help='position file', required=False, default='', type=su.str_arr_type) args = su.parse_args(parser, argv) if len(args.subjects) == 0: args.subjects = [args.subject] if len(args.pos_file) == 0: args.pos_file = [''] * len(args.subjects) pos_files = [] for subject, pos_file in zip(args.subjects, args.pos_file): args.subject = subject pos_files_fol = op.join(su.get_mmvt_dir(), args.subject, 'electrodes') if pos_file == '': pos_file_options = glob.glob( op.join(pos_files_fol, 'electrodes*positions*.npz')) if args.bipolar: pos_file_options = [ fname for fname in pos_file_options if 'bipolar' in fname ] else: pos_file_options = [ fname for fname in pos_file_options if 'bipolar' not in fname ] if len(pos_file_options) == 0: raise Exception('No electrodes position files in {}!'.format( pos_files_fol)) elif len(pos_file_options) == 1: pos_file = pos_file_options[0] print('electrodes file: {}'.format(pos_file)) else: raise Exception( 'More than one electrodes positions files in {}'.format( pos_files_fol) + 'please indicate which one using the -p flag') pos_files.append(pos_file) args.pos_file = pos_files if len(args.pos_file) == 1: args.pos_file = args.pos_file[0] return args
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('-t', '--threshold', help='threshold', required=True, type=float) parser.add_argument('--play_type', help='what to play', required=True) parser.add_argument('--play_from', help='from when to play', required=False, default=0, type=int) parser.add_argument('--play_to', help='until when to play', required=True, type=int) parser.add_argument('--play_dt', help='play dt', required=False, default=1, type=int) parser.add_argument('--output_path', help='output path', required=True) parser.add_argument('--rel_output_path', help='relative output path', required=False, default=True, type=su.is_true) parser.add_argument('--quality', help='render quality', required=False, default=60, type=int) parser.add_argument('--smooth_figure', help='smooth figure', required=False, default=False, type=su.is_true) parser.add_argument('--selection_type', help='selection type (diff, conds, spec_cond)', required=False, default='diff') parser.add_argument('--hide_lh', help='hide left hemi', required=False, default=False, type=su.is_true) parser.add_argument('--hide_rh', help='hide right hemi', required=False, default=False, type=su.is_true) parser.add_argument('--hide_subs', help='hide sub corticals', required=False, default=False, type=su.is_true) return su.parse_args(parser, argv)
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('--stat', help='conds stat', required=False, default=STAT_DIFF) parser.add_argument('--modality', help='modality', required=False, default='meg') parser.add_argument('--load_data', help='load_data', required=False, default=1, type=su.is_true) parser.add_argument('--overwrite_sensors', required=False, default=0, type=su.is_true) return su.parse_args(parser, argv)
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('-t', '--type', help='connection type', required=False, default='') parser.add_argument('--threshold', help='connection threshold', required=False, default=0, type=int) args = su.parse_args(parser, argv) rois_file_exist = op.isfile( op.join(su.get_mmvt_dir(), args.subject, 'rois_con.npz')) electrodes_file_exist = op.isfile( op.join(su.get_mmvt_dir(), args.subject, 'electrodes_con.npz')) if args.type == '': if rois_file_exist and electrodes_file_exist: raise Exception( 'More than one connection file exist, please select one using the -t flag' ) elif rois_file_exist: args.type = 'rois' elif electrodes_file_exist: args.type = 'electrodes' else: raise Exception('No connection file was found!\n' + 'ROIs connection file: rois_con.npz\n' + 'Electrodes connection file: electrodes_con.npz') elif args.type == 'rois': if not rois_file_exist: raise Exception( 'You chose ROIs connection, but the file rois_con.npz does not exist!' ) elif args.type == 'electrodes': if not electrodes_file_exist: raise Exception( 'You chose electrodes connection, but the file electrodes_con.npz does not exist!' ) return args
def read_args(argv=None): parser = su.add_default_args() # Add more args here parser.add_argument('-q', '--quality', help='render quality', required=False, default=60, type=int) parser.add_argument('--inflated', required=False, default='0,1', type=su.bool_arr_type) parser.add_argument('--inflated_ratio', required=False, default=0.5, type=float) parser.add_argument('--background_color', required=False, default='black,white', type=su.str_arr_type) parser.add_argument('--lighting', required=False, default='1.0,0.7', type=su.float_arr_type) parser.add_argument('--transparency', required=False, default=0.0, type=float) parser.add_argument('--light_layers_depth', required=False, default=0, type=int) parser.add_argument('--rendering_in_the_background', required=False, default=0, type=su.is_true) parser.add_argument('--clusters_type', required=False, default='') parser.add_argument('--dpi', required=False, default=100, type=int) parser.add_argument('--overwrite', required=False, default=1, type=su.is_true) parser.add_argument('--colors_map', required=False, default='') parser.add_argument('--x_left_crop', required=False, default=400, type=float) parser.add_argument('--x_right_crop', required=False, default=400, type=float) parser.add_argument('--y_top_crop', required=False, default=0, type=float) parser.add_argument('--y_buttom_crop', required=False, default=0, type=float) parser.add_argument('--w_fac', required=False, default=2, type=float) parser.add_argument('--h_fac', required=False, default=3/2, type=float) return su.parse_args(parser, argv)
def read_args(argv=None): parser = su.add_default_args() return su.parse_args(parser, argv)
def read_args(argv=None): parser = su.add_default_args() # Add more args here parser.add_argument('-q', '--quality', help='render quality', required=False, default=60, type=int) parser.add_argument('--inflated', required=False, default='0,1', type=su.bool_arr_type) parser.add_argument('--inflated_ratio', required=False, default=0.5, type=float) parser.add_argument('--background_color', required=False, default='black,white', type=su.str_arr_type) parser.add_argument('--lighting', required=False, default='1.0,0.7', type=su.float_arr_type) parser.add_argument('--transparency', required=False, default=0.0, type=float) parser.add_argument('--light_layers_depth', required=False, default=0, type=int) parser.add_argument('--rendering_in_the_background', required=False, default=0, type=su.is_true) parser.add_argument('--clusters_type', required=False, default='') parser.add_argument('--dpi', required=False, default=100, type=int) parser.add_argument('--overwrite', required=False, default=1, type=su.is_true) parser.add_argument('--colors_map', required=False, default='') parser.add_argument('--x_left_crop', required=False, default=400, type=float) parser.add_argument('--x_right_crop', required=False, default=400, type=float) parser.add_argument('--y_top_crop', required=False, default=0, type=float) parser.add_argument('--y_buttom_crop', required=False, default=0, type=float) parser.add_argument('--w_fac', required=False, default=2, type=float) parser.add_argument('--h_fac', required=False, default=3 / 2, type=float) return su.parse_args(parser, argv)
def read_args(argv=None): parser = su.add_default_args() parser.add_argument('-o', '--output_path', help='output path', required=False, default='') parser.add_argument('-i', '--image_name', help='image name', required=False, default='', type=su.str_arr_type) parser.add_argument('-q', '--quality', help='render quality', required=False, default=60, type=int) parser.add_argument('-c', '--camera', help='camera fname', required=False, default='', type=su.str_arr_type) parser.add_argument('--inflated', required=False, default=0, type=su.is_true) parser.add_argument('--inflated_ratio', required=False, default=1.0, type=float) parser.add_argument('--background_color', required=False, default='black') parser.add_argument('--lighting', required=False, default=1.0, type=float) parser.add_argument('--smooth_figure', help='smooth figure', required=False, default=False, type=su.is_true) parser.add_argument('--hide_lh', help='hide left hemi', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--hide_rh', help='hide right hemi', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--hide_subs', help='hide sub corticals', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--show_elecs', help='show electrodes', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--show_only_lead', help='show only current lead', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--curr_elec', help='current electrode', required=False, default='') parser.add_argument('--show_connections', help='show connections', required=False, default=None, type=su.is_true_or_none) parser.add_argument('--filter_nodes', help='filter nodes', required=False, default=True, type=su.is_true) parser.add_argument('--interactive', required=False, default=1, type=su.is_true) parser.add_argument('--overwrite', required=False, default=1, type=su.is_true) args = su.parse_args(parser, argv) return args
def read_args(argv=None): parser = su.add_default_args() # Add more args here return su.parse_args(parser, argv)
def add_args(): parser = su.add_default_args() parser.add_argument('-t', '--threshold', help='threshold', required=False, default=2.0, type=float) parser.add_argument('-q', '--quality', help='render quality', required=False, default=60, type=int) parser.add_argument('-p', '--play_type', help='what to play', required=True) parser.add_argument('--play_from', help='from when to play', required=False, default=0, type=int) parser.add_argument('--play_to', help='until when to play', required=True, type=int) parser.add_argument('--play_dt', help='play dt', required=False, default=1, type=int) parser.add_argument('--light_layers', help='light_layers', required=False, default=0, type=int) parser.add_argument('--brain_trans', help='brain_transparency', required=False, default=1, type=float) parser.add_argument('--output_path', help='output path', required=False, default='') parser.add_argument('--rel_output_path', help='relative output path', required=False, default=True, type=su.is_true) parser.add_argument('--smooth_figure', help='smooth figure', required=False, default=False, type=su.is_true) parser.add_argument('--selection_type', help='selection type (diff, conds, spec_cond)', required=False, default='diff') parser.add_argument('--hide_lh', help='hide left hemi', required=False, default=False, type=su.is_true) parser.add_argument('--hide_rh', help='hide right hemi', required=False, default=False, type=su.is_true) parser.add_argument('--hide_subs', help='hide sub corticals', required=False, default=False, type=su.is_true) parser.add_argument('--filter_nodes', help='filter nodes', required=False, default=True, type=su.is_true) parser.add_argument('--camera', help='camera file', required=False, default='') parser.add_argument('--set_to_camera_mode', help='', required=False, default=False, type=su.is_true) parser.add_argument('--mark_electrodes', help='mark_electrodes', required=False, default='', type=su.str_arr_type) parser.add_argument('--mark_electrodes_value', help='mark_electrodes_value', required=False, default=0.1, type=float) parser.add_argument('--mark_other_electrodes', help='mark_other_electrodes', required=False, default=False, type=su.is_true) return parser
def read_args(argv=None): parser = su.add_default_args() parser = add_args(parser) return su.parse_args(parser, argv)
def read_args(argv=None): print('play_electrodes argv: {}'.format(argv)) parser = su.add_default_args() parser = add_args(parser) return su.parse_args(parser, argv)