<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def main(param_path='parameters.txt'):
 """ Entry point function for analysis based on parameter files. Parameters param_path : str Path to user-generated parameter file """


    # Confirm parameters file is present
    if not os.path.isfile(param_path):
        raise IOError, "Parameter file not found at %s" % param_path

    # Get raw params and base options (non-run-dependent options)
    params, base_options = _get_params_base_options(param_path)

    # Configure and start logging
    # Done here instead of in function so will affect all subsequent calls
    log_path = os.path.join(base_options['results_dir'], '_log.txt')
    if os.path.isfile(log_path):
        os.remove(log_path)

    logging.basicConfig(level=logging.INFO, format='%(message)s')

    fileh = logging.FileHandler(log_path)
    fileh.setLevel(logging.DEBUG)
    filefmt = logging.Formatter(
            time.strftime("%Y/%m/%d %H:%M:%S %p", time.localtime()) + 
            ' - %(name)s - %(levelname)s - %(message)s')
    fileh.setFormatter(filefmt)
    logging.getLogger('').addHandler(fileh)

    def log_uncaught(type1, value1, traceback1):
        tb_list = traceback.format_exception(type1, value1, traceback1)
        tb_str = ''.join(tb_list)
        logging.critical('\n\n'+tb_str)
    sys.excepthook = log_uncaught

    logging.info('Running macroeco') # v%s' % __version__)
    logging.info('Parameters file at %s' % os.path.abspath(param_path))

    # Preliminary check for errors in parameters file
    bad_params = misc.check_parameter_file(param_path)
    if len(bad_params[0]) > 0:
        logging.warning("Possible formatting error(s) in" +
                    " %s: parameters %s on lines %s"
                      % (param_path, bad_params[0], bad_params[1]))

    logging.info('Starting analysis')

    # Do analysis for each run
    for run_name in base_options['run_names']:
        logging.info('Starting run %s' % run_name)
        options = dict(params[run_name])  # All parameters from this run
        options.update(base_options)  # Add base parameters
        options['run_dir'] = os.path.join(base_options['results_dir'],run_name)
        if 'format' in options['analysis']:
            _do_format(options)
        else:
            _do_analysis(options)
        logging.info('Finished run %s' % run_name)
    logging.info('Finished analysis successfully')
    logging.info('Results available at %s' % options['param_dir'])

    # Close logging - releases log file lock in Windows GUI
    logging.shutdown()