BCDA-APS / gemviz

Data visualization for tiled
https://bcda-aps.github.io/gemviz/
Other
4 stars 0 forks source link

Use a filtered catalog. #63

Closed prjemian closed 1 year ago

prjemian commented 1 year ago

The present code uses the complete catalog from the server. Instead, return a catalog with the filter terms applied.

prjemian commented 1 year ago

It is not possible to filter on the Status at this time. That information comes from the stop document and the current search tools available don't search that document at this time. This highly-requested feature might come by the end of 2023Q4. Maybe.

We should disable that item in the UI file, for now.

prjemian commented 1 year ago

For the Motor filter, they are named in a list, so we should allow the user to specify more than one motor name. For example: m1 m2 would search for runs where both m1 and m2 appear in the list of motors for that run.

The Scan Id is an integer. We need to make sure that we convert the string to an int when searching.

prjemian commented 1 year ago

To use the DateTimeSlider to select a range of dates, we need to configure that with the information from the catalog. We can add that configuration in this method after these lines: https://github.com/BCDA-APS/tiled-viz2023/blob/7285cc3731f0a89126082e2637d1dca2754d7212/gemviz23/demo/filterpanel.py#L42-L44

prjemian commented 1 year ago

On these lines we get the full catalog from the server: https://github.com/BCDA-APS/tiled-viz2023/blob/7285cc3731f0a89126082e2637d1dca2754d7212/gemviz23/demo/resultwindow.py#L232-L233

The view should not do this. Instead, we should ask the filterpanel for the filtered catalog at this point. The filterpanel needs a new method for this.

prjemian commented 1 year ago

We should add explanatory tooltips to each of the widgets

prjemian commented 1 year ago

With tiled, a search of a catalog results in a new catalog.

cat = cat.search(query)
prjemian commented 1 year ago

Date & time values come from the DateTimeRangeSlider widget:

        since = self.date_time_widget.low()
        until = self.date_time_widget.high()
        # cat = utils.get_tiled_runs(cat, since=since, until=until)
prjemian commented 1 year ago

Motor search was not quite right. With more than one motor to search, we searched for runs that had the first name (and only the first name), then runs that had only the second name. That would always be an empty list. There is a different tiled search to get that.

tiled.queries.Contains("motors", motor)
prjemian commented 1 year ago

For Contains() query, see https://blueskyproject.io/tiled/reference/queries.html

prjemian commented 1 year ago

Tiled lets us quickly and efficiently get the first and last runs in a catalog:

cat.keys().first()
cat.keys().last()
prjemian commented 1 year ago

Each of those returns a uid for the particular run. To get the start time (which is a Python timestamp):

            run = cat[uid]
            start_time = run.metadata["start"]["time"]
prjemian commented 1 year ago

the widget controls to set:

        self.date_time_widget.setMinimum(t_lo)
        self.date_time_widget.setLow(t_lo)
        self.date_time_widget.setHigh(t_hi)
        self.date_time_widget.setMaximum(t_hi)