Example #1
0
        ftpdetectinfo_path_list += glob.glob(entry)

    # If therea are files given, notify the user
    if len(ftpdetectinfo_path_list) == 0:
        print('No valid FTPdetectinfo files given!')
        sys.exit()


    # Extract parent directory and station ID from path
    dir_path, ftpdetectinfo_name = os.path.split(ftpdetectinfo_path_list[0])
    spls = ftpdetectinfo_name.split('_')
    statID = spls[1]

    # Load the config file
    if os.path.isfile(os.path.join(dir_path, '.config')):
        config = cr.loadConfigFromDirectory('.config', dir_path)
    else:
        config = cr.loadConfigFromDirectory(cml_args.config, dir_path)

    if config.stationID != statID:
        # load the camera location details if needed
        print('looking for StationInfo file')
        lat, lon = getSiteInfo(ftpdetectinfo_path_list)
        if lat is not None:
            config.latitude = lat
        if lon is not None:
            config.longitude = lon

        print('Checking commandline args')
        if cml_args.latitude is not None:
            config.latitude = cml_args.latitude
Example #2
0
if __name__ == "__main__":

    import argparse

    import RMS.ConfigReader as cr

    ### PARSE INPUT ARGUMENTS ###

    # Init the command line arguments parser
    arg_parser = argparse.ArgumentParser(
        description=""" Generate the calibration report.
        """)

    arg_parser.add_argument('dir_path',
                            type=str,
                            help="Path to the folder of the night.")

    arg_parser.add_argument('-c', '--config', nargs=1, metavar='CONFIG_PATH', type=str, \
        help="Path to a config file which will be used instead of the default one.")

    # Parse the command line arguments
    cml_args = arg_parser.parse_args()

    #############################

    # Load the config file
    config = cr.loadConfigFromDirectory(cml_args.config, cml_args.dir_path)

    generateCalibrationReport(config, cml_args.dir_path, show_graphs=True)
    # Init the command line arguments parser
    arg_parser = argparse.ArgumentParser(description="Detect stars and meteors in the given folder.")

    arg_parser.add_argument('dir_path', nargs=1, metavar='DIR_PATH', type=str, \
        help='Path to the folder with FF files.')

    arg_parser.add_argument('-c', '--config', nargs=1, metavar='CONFIG_PATH', type=str, \
        help="Path to a config file which will be used instead of the default one.")

    # Parse the command line arguments
    cml_args = arg_parser.parse_args()

    #########################

    # Load the config file
    config = cr.loadConfigFromDirectory(cml_args.config, cml_args.dir_path)


    ### Init the logger

    from RMS.Logger import initLogging
    initLogging(config, 'detection_')

    log = logging.getLogger("logger")

    ######


    # Run detection on the folder
    _, _, _, detector = detectStarsAndMeteorsDirectory(cml_args.dir_path[0], config)
Example #4
0
                            type=float,
                            help="Latitude in degrees (east is positive)")
    arg_parser.add_argument("longitude",
                            type=float,
                            help="Longitude in degrees (north is positive)")
    arg_parser.add_argument("height",
                            type=float,
                            help="Height to convert (in meters)")

    # Parse the command line arguments
    cml_args = arg_parser.parse_args()

    #########################

    # Load the config file
    config = cr.loadConfigFromDirectory(cml_args.config, ".")

    # Load latitude and longitude
    lat = cml_args.latitude
    lon = cml_args.longitude

    if not cml_args.inverse:
        print("Converting MSL height to WGS84 height")
        msl_height = cml_args.height
        wgs84_height = mslToWGS84Height(np.radians(lat), np.radians(lon),
                                        msl_height, config)
    else:
        print("Converting WGS84 height to MSL height")
        wgs84_height = cml_args.height
        msl_height = wgs84toMSLHeight(np.radians(lat), np.radians(lon),
                                      wgs84_height, config)
Example #5
0
    arg_parser.add_argument('-e',
                            '--detectend',
                            action="store_true",
                            help="""Detect stars and meteors at the
        end of the night, after capture finishes. """)

    arg_parser.add_argument('-r', '--resume', action="store_true", \
        help="""Resume capture into the last night directory in CapturedFiles. """)

    # Parse the command line arguments
    cml_args = arg_parser.parse_args()

    ######

    # Load the config file
    config = cr.loadConfigFromDirectory(cml_args.config, os.path.abspath('.'))

    # Initialize the logger
    initLogging(config)

    # Get the logger handle
    log = logging.getLogger("logger")

    log.info("Program start")
    log.info("Station code: {:s}".format(str(config.stationID)))

    # Change the Ctrl+C action to the special handle
    setSIGINT()

    # Make the data directories
    root_dir = os.path.abspath(config.data_dir)
    parser.add_argument('command',
                        metavar='command',
                        type=str,
                        nargs=1,
                        help=' | '.join(cmd_list))

    parser.add_argument(
        '-c',
        '--config',
        nargs=1,
        metavar='CONFIG_PATH',
        type=str,
        help=
        "Path to a config file which will be used instead of the default one.")

    args = parser.parse_args()
    cmd = args.command[0]

    if cmd not in cmd_list:
        print('Error: command "{}" not supported'.format(cmd))
        exit(1)

    config = cr.loadConfigFromDirectory(args.config, 'notused')

    if str(config.deviceID).isdigit():
        print('Error: this utility only works with IP cameras')
        exit(1)

    # Process the IP camera control command
    onvifCommand(config, cmd)
Example #7
0
                     default=None)
    nmp.add_argument('--adir', type=str, \
                     help="subdirectory of ArchivedFiles with the most recent capture data. For example, US0006_20220306_020833_56612.", \
                     default=None)
    nmp.add_argument('--config', type=str, nargs=1, metavar='CONFIG_PATH', \
                     help="Path to a config file which will be used in place of the default one.")
    args = nmp.parse_args()

    if args.cdir is None:
        
        # Now want to do the same thing as "find . -type d -print | sort -r",
        # and take the first line to get the most recent directory.
        c_dir=os.path.expanduser("~/RMS_data/CapturedFiles")
        print (c_dir, ":")
        print ( sorted( os.listdir(c_dir), reverse=True)[0] )

    if args.adir is None:
        a_dir = os.path.expanduser("~/RMS_data/ArchivedFiles")
        print (a_dir, ":")
        print (sorted ( os.listdir(a_dir), reverse=True)[0] )

    # Now get the config object.
    config = cr.loadConfigFromDirectory(args.config, os.path.abspath('${HOME}/source/RMS'))

    print ("config data :")
    print (config.stationID)

    # Now call iStream.py with args c_dir, a_dir, config

    iStream.iStream.rmsExternal(c_dir, a_dir, config)
                                                      config, flat_struct,
                                                      dark, mask)

    print(star_list)
    print(meteor_list)


if __name__ == '__main__':
    ### COMMAND LINE ARGUMENTS
    # Init the command line arguments parser
    arg_parser = argparse.ArgumentParser(
        description="Analyses a UFO avi with RMS.")

    arg_parser.add_argument('ff_path', nargs='+', metavar='FILE_PATH', type=str, \
        help='Full path and name of the file to analyse')

    arg_parser.add_argument('-c', '--config', nargs=1, metavar='CONFIG_PATH', type=str, \
        help="Path to a config file which will be used instead of the default one.")

    # Parse the command line arguments
    cml_args = arg_parser.parse_args()

    #########################

    ff_directory, ff_name = os.path.split(cml_args.ff_path[0])

    print(ff_directory, ff_name)
    config = cr.loadConfigFromDirectory(cml_args.config[0], ff_directory)
    print("loaded config \n\n\n")

    AnalyseUFOwithRMS(config, ff_directory, ff_name)
Example #9
0
            if not os.path.isfile(ftpdetectinfo_path):
                print("The FTPdetectinfo file does not exist:",
                      ftpdetectinfo_path)
                print("Exiting...")
                sys.exit()

            # Parse the beg/end time
            dt_beg = datetime.datetime.strptime(tbeg, "%Y%m%d_%H%M%S")
            dt_end = datetime.datetime.strptime(tend, "%Y%m%d_%H%M%S")

            # Extract parent directory
            ftp_dir_path = os.path.dirname(ftpdetectinfo_path)

            # Load the config file
            config = cr.loadConfigFromDirectory('.', ftp_dir_path)

            # Compute the flux
            sol_data, flux_lm_6_5_data = computeFlux(config, ftp_dir_path, ftpdetectinfo_path, shower_code, \
                dt_beg, dt_end, dt, s, show_plots=False)

            # Add computed flux to the output list
            output_data += [[config.stationID, sol, flux]
                            for (sol, flux) in zip(sol_data, flux_lm_6_5_data)]

            # Make all stations the same color
            if config.stationID not in color_dict:

                # Generate a new color
                color = color_cycle[len(color_dict) % (len(color_cycle))]
                label = str(config.stationID)