def reduce_cross(in_path, step=50): feat_dict = feats.read(in_path)[0] n = int(feat_dict.dim()[0] / step) acc, dataset = [], [] for i in range(n): feat_i = reduction.reduce(feat_dict, (i + 1) * step) dataset.append(feat_i) acc.append(rename.cross_validate(feat_i)) print(acc) k = np.argmax(acc) return ((k + 1) * step)
def make_reduced_dataset(common, out_path, n_feats=350): common = files.get_paths(common) dataset = ens.read_dataset(common, None)[0] dataset.norm() redu_data = reduction.reduce(dataset, n_feats) redu_data.save(out_path)
args.telescope = 'lofar' # already channelized, determined from filehandle # (previously args.nchan = 20) args.ntw_min = 1020 args.waterfall = False args.verbose += 1 args.rfi_filter_raw = None elif args.reduction_defaults == 'aro': # do little, most args are already set to aro.py defaults args.telescope = 'aro' args.ntw_min = 1020 args.verbose += 1 args.rfi_filter_raw = rfi_filter_raw elif args.reduction_defaults == 'gmrt': args.telescope = 'gmrt' args.nchan = 512 args.ngate = 512 args.ntbin = 5 # 170 /(100.*u.MHz/6.) * 512 = 0.0052224 s = 256 bins/pulse args.ntw_min = 170 args.rfi_filter_raw = None args.verbose += 1 reduce( args.telescope, args.date, tstart=args.tstart, tend=args.tend, nchan=args.nchan, ngate=args.ngate, ntbin=args.ntbin, ntw_min=args.ntw_min, rfi_filter_raw=args.rfi_filter_raw, do_waterfall=args.waterfall, do_foldspec=args.foldspec, dedisperse=args.dedisperse, fref=args.fref, verbose=args.verbose)
# !/usr/bin/python import sys from reduction import reduce COLS = { 'ts': 0, 'src': 1, 'src_name': 2, 'type': 3, 'dst': 4 } if __name__ == '__main__': forward_file_path = sys.argv[1] backward_file_path = sys.argv[2] out_dir = sys.argv[3] reduce(forward_file_path, backward_file_path, out_dir)
elif args.reduction_defaults == 'aro': # do little, most args are already set to aro.py defaults args.telescope = 'aro' args.ntw_min = 1020 args.verbose += 1 args.rfi_filter_raw = rfi_filter_raw elif args.reduction_defaults == 'gmrt': args.telescope = 'gmrt' args.nchan = 512 args.ngate = 512 args.ntbin = 5 # 170 /(100.*u.MHz/6.) * 512 = 0.0052224 s = 256 bins/pulse args.ntw_min = 170 args.rfi_filter_raw = None args.verbose += 1 reduce(args.telescope, args.date, tstart=args.tstart, tend=args.tend, nchan=args.nchan, ngate=args.ngate, ntbin=args.ntbin, ntw_min=args.ntw_min, rfi_filter_raw=args.rfi_filter_raw, do_waterfall=args.waterfall, do_foldspec=args.foldspec, dedisperse=args.dedisperse, fref=args.fref, verbose=args.verbose)