@orca.step()
def trip_mode_choice_simulate(tours_merged,
                              trip_mode_choice_spec,
                              trip_mode_choice_settings,
                              skims, omx_file, cache_skim_key_values):

    # FIXME running the trips model on tours
    trips = tours_merged.to_frame()

    choices_list = []

    # FIXME - log
    print "Trip types:\n", trips.tour_type.value_counts()

    for tour_type, segment in trips.groupby('tour_type'):

        # FIXME - log
        print "running tour_type '%s'" % tour_type

        # FIXME - hack to run subset of tour types
        # TOUR_TYPE_SUBSET = []
        # # TOUR_TYPE_SUBSET = ['eatout']
        # if TOUR_TYPE_SUBSET and tour_type not in TOUR_TYPE_SUBSET:
        #     print "skipping tour_type %s" % tour_type
        #     continue

        tour_type_tours = trips[trips.tour_type == tour_type]
        orig_key = 'TAZ'
        dest_key = 'destination'

        # FIXME - check that destination is not null (patch_mandatory_tour_destination not run?)

        # FIXME - log
        # print "dest_taz counts:\n", tour_type_tours[dest_key].value_counts()

        choices = _mode_choice_simulate(
            tour_type_tours,
            skims,
            orig_key=orig_key,
            dest_key=dest_key,
            spec=get_segment_and_unstack(trip_mode_choice_spec, tour_type),
            additional_constants=trip_mode_choice_settings['CONSTANTS'],
            omx=omx_file,
            cache_skim_key_values=cache_skim_key_values)

        # FIXME - log
        # print "Choices:\n", choices.value_counts()

        choices_list.append(choices)

        # FIXME - this forces garbage collection
        print asim.usage('tour_type %s' % tour_type)

    choices = pd.concat(choices_list)

    # FIXME - log
    print "Choices for all trip types:\n", choices.value_counts()

    orca.add_column("trips", "mode", choices)

    # FIXME - this forces garbage collection
    print asim.usage('trip_mode_choice_simulate')
dataset/ETHPy150Open UDST/activitysim/activitysim/defaults/models/mode.py/trip_mode_choice_simulate/original