Skip to content

get_detail_data_frame() fails when passed list of DetailEvent objects #247

@johndwest

Description

@johndwest

Describe the bug
documentation states that get_detail_data_frame() accepts a list of DetailEvent objects
documentation states that DetailEvent objects can be acquired using the get_event_by_id() method
BUT: get_detail_data_frame() fails when passed a list of DetailEvent objects, works when passed a list of SummaryEvent objects

To Reproduce
ThisEvent = 'ak01613v15nv'
try:
detailE = get_event_by_id(eventid=ThisEvent)
DummyList = []
DummyList.append(detailE)
moment_df = get_detail_data_frame(events=DummyList, get_tensors='preferred')
except Exception as ex:
MsgText = "ADEPT script error retrieving moment tensors."
print(MsgText, str(ex) + traceback.format_exc())

Expected behavior
Per the documentation I expect get_detail_data_frame() to return a dataframe containing data for the chosen DetailEvent. It fails.

Environment (please complete the following information):
OS: Ubuntu 20.04.1 LTS
Python Version 3.8
Libcomcat Version 2.0
Numpy Version 1.20.3

Additional context
Source code file dataframes.py, line 348 assumes that the event list passed to get_detail_data_frame() is a list of SummaryEvent objects, contrary to the documentation and the needs of anyone trying to get the moment tensor solution for a single event. I suggest the code in this module should check to see if the passed objects are already DetailEvent objects before trying to convert them to DetailEvents.

As an additional suggestion: it might be nice if the function would accept a single DetailEvent object instead of requiring the user to put the object in a list of one item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions