def test_readwrite(self): SQM = obs.Datafile() path = os.path.dirname(__file__) SQM.read(os.path.join(path, "ref.dat")) SQM.compute() SQM.write(os.path.join(path, "result.dat")) self.assertTrue( filecmp.cmp(os.path.join(path, "ref.dat"), os.path.join(path, "result.dat")), 'Files differ')
def test_debugcsv(self): SQM = obs.Datafile() path = os.path.dirname(__file__) SQM.read(os.path.join(path, "ref.dat")) SQM.compute() SQM.reduce_midnight() SQM.debug_csv(os.path.join(path, "debugcsv.dat")) self.assertTrue( filecmp.cmp(os.path.join(path, "debugcsv.dat"), os.path.join(path, "debugcsvref.dat")), 'Files differ')
def test_writesunmoon(self): SQM = obs.Datafile() path = os.path.dirname(__file__) SQM.read(os.path.join(path, "ref.dat")) SQM.compute() SQM.reduce_dark() SQM.write(os.path.join(path, "sunmoon.dat")) self.assertTrue( filecmp.cmp(os.path.join(path, "sunmoon.dat"), os.path.join(path, "sunmoonref.dat")), 'Files differ')
help='Minimum altitude of the Moon in degress relaive to the horizon ' 'to consider for --dark. (Default: %(default)s)') parser.add_argument( '-s', '--minsun', dest='minsun', type=float, default='-18', help='Minimum altitude of the Sun in degress relaive to the horizon ' 'to consider for --dark. (Default: %(default)s)') parser.add_argument('-o', '--outfile', dest='outfile', default='stdout', help='File to write output to. (Default: %(default)s).') args = parser.parse_args() SQM = observations.Datafile() SQM.read(args.infile) SQM.compute() SQM.reduce_dark(sunlow=args.minsun, moonlow=args.minmoon) if args.antitransit: SQM.reduce_midnight() if args.outfile == "stdout": SQM.write() else: SQM.write(args.outfile)