Skip to content

Fix emval.input.phone_view for Stationary calibration notebook #28

@kennykos

Description

@kennykos

@shankari as we talked about yesterday, pv_mf.validate() is failing with the following stack trace

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-12-9bf65c656a3e> in <module>
      1 # pv_hf.validate()
----> 2 pv_mf.validate() # TODO: uncomment this out

~/Documents/nrel/mobilitynet-analysis-scripts/emeval/input/phone_view.py in validate(self)
     82     def validate(self):
     83         print(20 * "-", "About to validate calibration settings", 20 * "-")
---> 84         evpv.validate_calibration_settings(self)
     85         print(20 * "-", "About to validate evaluation settings", 20 * "-")
     86         evpv.validate_evaluation_settings(self)

~/Documents/nrel/mobilitynet-analysis-scripts/emeval/validate/phone_view.py in validate_calibration_settings(phone_view)
    106             # assert unique_test_ids == spec_test_ids, "Missing calibration test while comparing %s, %s" % (unique_test_ids, spec_test_ids)
    107             for r in curr_calibration_ranges:
--> 108                 config_during_test_entries = phone_view.spec_details.retrieve_data_from_server(phone_label, ["config/sensor_config"], r["start_ts"], r["end_ts"])
    109                 print("%s -> %s" % (r["trip_id"], [c["data"]["accuracy"] for c in config_during_test_entries]))
    110                 # assert len(config_during_test_entries) == 1, "Out of band configuration? Found %d config changes" % len(config_during_test_entries)

AttributeError: 'ServerSpecDetails' object has no attribute 'retrieve_data_from_server'

retrieve_data_from_server is an antiquated function, with the updated version seeming to be retrieve_data. However, when

def validate_calibration_settings(phone_view)

is updated with retrieve_data replacing retrieve_data_from_server, a new error occurs with the following stack trace

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-12-9bf65c656a3e> in <module>
      1 # pv_hf.validate()
----> 2 pv_mf.validate() # TODO: uncomment this out

~/Documents/nrel/mobilitynet-analysis-scripts/emeval/input/phone_view.py in validate(self)
     82     def validate(self):
     83         print(20 * "-", "About to validate calibration settings", 20 * "-")
---> 84         evpv.validate_calibration_settings(self)
     85         print(20 * "-", "About to validate evaluation settings", 20 * "-")
     86         evpv.validate_evaluation_settings(self)

~/Documents/nrel/mobilitynet-analysis-scripts/emeval/validate/phone_view.py in validate_calibration_settings(phone_view)
    109                 print("%s -> %s" % (r["trip_id"], [c["data"]["accuracy"] for c in config_during_test_entries]))
    110                 # assert len(config_during_test_entries) == 1, "Out of band configuration? Found %d config changes" % len(config_during_test_entries)
--> 111                 config_during_test = config_during_test_entries[0]["data"]
    112                 expected_config = expected_config_map[r["trip_id_base"]]
    113                 # print(config_during_test, expected_config)

IndexError: list index out of range

We see that config_during_test_entries is declared using retrieve_data,

config_during_test_entries = phone_view.spec_details.retrieve_data(phone_label, ["config/sensor_config"], r["start_ts"], r["end_ts"])

If index 0 is out of range, then retrieve_data is returning an empty list for this specific ServerSpecDetails.
The only way that this happens is if

if len(curr_location_entries) == 0 or len(curr_location_entries) == 1:
   all_done = True

is true after one call to

curr_location_entries = self.retrieve_one_batch(user, key_list, curr_start_ts, end_ts)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions