- Overview
- Before You Start
- Getting Ready
- Launching the Viewer
- Interface Tour
- Loading and Managing Logs
- Understanding Categories and Blocks
- Controlling Visibility
- Navigating Large Logs
- Working with Pipetting Data
- Reading Metrics and Status Messages
- Keyboard and Mouse Shortcuts
- Example Workflow
- Customization Guide
- Packaging a Standalone Build
- Troubleshooting and Tips
- Project Layout
- Next Steps
HSLViewer is a desktop application for inspecting Hamilton STAR and STARlet trace logs (.trc, .log, .txt). It classifies each line into high level categories, builds collapsible blocks with inline summaries, and highlights pipetting activity so that you can review runs, diagnose failures, and spot anomalies quickly.
Core capabilities include:
- Automatic detection and color-coding of critical events, user traces, pipetting steps, CO-RE gripper activity, heater/shaker operations, and system chatter.
- Collapsible blocks with inline summaries so you can skim runs without losing context.
- Time-aware selection readouts that show elapsed time with and without error intervals.
- A pipetting analyzer that aligns channel data, highlights labware, and exposes a detailed aspirate/dispense table for any selection.
- Search, go-to-line/time, and a jump palette that let you move through large logs without manual scrolling.
- A ttk-based dark theme tuned for long sessions and consistent across Windows, macOS, and Linux.
Make sure the following prerequisites are in place before launching the viewer.
- Operating system: Windows 10/11, macOS 12 or newer, or a modern Linux distribution with Tk support. The UI is built on tkinter and tested on 1920x1080 or higher displays.
- Python: install Python 3.10 or newer from https://www.python.org. During installation on Windows, enable "Add Python to PATH".
- Tk availability: verify tkinter is present by running
python -m tkinterin a terminal. A small window should appear; close it once confirmed. If the command fails, install the tkinter package for your platform (for examplesudo apt install python3-tkon Debian/Ubuntu orbrew install python-tkon macOS with Homebrew). - Log files: ensure you can read the .trc, .log, or .txt files you intend to inspect. Large logs (hundreds of thousands of lines) are supported but benefit from SSD storage.
- Optional but recommended: a mouse or trackpad for working with the gutter and legend buttons.
The repository already contains everything required to run the viewer. Use the following steps to prepare the workspace.
- Download or clone the project.
- Clone:
git clone https://github.com/your-org/HSLViewer.git - Download: use GitHub's "Download ZIP", then extract the archive.
- Clone:
- Open a terminal or PowerShell window and change into the project directory, for example
cd HSLViewer. - (Optional but encouraged) create a virtual environment so that any future dependencies stay isolated:
Activate it with:
python -m venv .venv- PowerShell:
.venv\Scripts\Activate.ps1 - Command Prompt:
.venv\Scripts\activate.bat - macOS/Linux:
source .venv/bin/activate
- PowerShell:
- Upgrade pip inside the environment so builds stay reproducible:
python -m pip install --upgrade pip - Install runtime dependencies. The viewer only relies on the Python standard library and tkinter, so there is nothing extra to install. If you plan to package a standalone executable later, install PyInstaller now with
pip install pyinstaller. - Verify the environment by launching an interactive session with
python. Import tkinter (import tkinter) to confirm the module resolves, then exit.
You can run HSLViewer either by double-clicking the launcher script on Windows or from any terminal session.
- Locate
hamilton_log_highlighter.pyin the project root. - Double-click the file. The script relaunches itself using pythonw.exe so that no console window stays open.
- If Windows asks how to open .py files, choose "Python" from the list. After the first run the association is remembered.
- The main window appears sized to 1280x800 by default. Resize it as needed; the current geometry is remembered per log file.
- Open a terminal with the project directory as the working folder.
- To start without an initial log, run:
python hamilton_log_highlighter.py - To load a log immediately, provide the path as the first argument:
Paths containing spaces must be quoted.
python hamilton_log_highlighter.py path\to\run.trc - Optional flags:
--no-relaunchdisables the pythonw auto-relaunch (useful on Linux or macOS).--diagnosticskeeps console logging visible for debugging crashes.
- Keep the terminal open while you work if you want to see diagnostic prints (for example when enabling pipette sync tracing).
If you want a practice file, open examples/HamiltonStar_Vibrant_TBDS_NZPS_12col_8Plates_Ver1.1.0_5c483a5222e0406faa37d634b4187b92_Trace.trc. It highlights all major features.
The window is divided into five regions. Understanding them up front makes navigation easier.
- Primary actions: Open, Reload, Find, Go To, Jump.
- Toggle buttons on the right mirror view options: Compact, Hover, Summaries, Stripes. Each button reflects the current state.
- The
More...drop-down exposes secondary commands such as Zoom In/Out, Reset Zoom, Focus-only Summary Colors, Clear Focus, Collapse All, and Expand All.
- A fixed-width gutter on the left shows line numbers and displays a
+or-button for the block under the mouse. - The central
Textwidget renders the log with syntax colors, inline block summaries, selection highlights, and pipetting overlays. - Vertical and horizontal scrollbars sit on the right and bottom of the pane. Scrolling schedules a throttled gutter redraw so the UI stays fluid on large files.
- The log is read-only to prevent accidental edits. Select text with the mouse or keyboard; copy works via
Ctrl+CorCmd+C.
- Lists every category rule with a color swatch.
- Clicking a category name sets the focus filter, dimming every other category. Right-click the same label to clear focus.
- Each category row has quick action buttons:
Collapse this categoryfolds all blocks of that type.Expand this categoryrestores them.Hide this categoryelides all lines of that type.Show this categorymakes a hidden category visible again.
- Provides one-click toggles for Collapse All, Expand All, Compact Lines, Color Summaries, Hover Highlight, and Collapsed Stripes.
- These buttons stay visible even when dialogs are open, so you can recover from an aggressive collapse quickly.
- A metrics label on the right reports total run time and total time excluding critical error intervals whenever the log contains timestamps.
- The status bar beneath it reports contextual hints (for example "Loaded: ...", search results, selection spans, pipetting summaries).
- Messages remain until the next action, so you can glance away without missing the result.
- Click
Openon the command bar or pressCtrl+O. Choose a .trc, .log, or .txt file. The viewer reads the file with error replacement so malformed bytes do not abort the load. - The window title updates to include the filename, and a status message reports the number of lines loaded.
- Click
Reloador pressCtrl+Rto re-read the same file after external edits. The viewer reclassifies and rebuilds blocks each time. - The application writes a small JSON state file alongside the log (for example
Run.trc.state.json). It remembers zoom level, compact mode, focus category, which categories are hidden, and the window geometry. Delete this file to reset preferences for that log. - The last used settings persist per log. When you open a different log the viewer applies the defaults until you adjust them.
- If the file cannot be read, a dialog explains the error and the status bar reports it. Consult
hamilton_log_highlighter.error.login the project root for stack traces when troubleshooting.
HSLViewer groups consecutive lines that share a category into a block. Blocks are the unit you collapse, jump to, and summarize.
Classification rules live in hslviewer/rules.py and are applied top-to-bottom. The defaults are:
| Category | Color (hex) | Trigger pattern | Typical meaning |
|---|---|---|---|
| Critical | #ff6b6b | Any line containing "Abort", "ERROR", or "Warning" (case-insensitive) | Failures, warnings, aborted steps. These blocks are highlighted in bold and feed timing metrics. |
| USER Trace | #7ee787 | Lines starting with "USER : Trace" | Operator annotations or scripted trace markers. Summaries are suppressed to keep the raw note. |
| Pipetting | #58a6ff | "Aspirate", "Dispense", "Tip Pick Up", or "Tip Eject" | Liquid handling steps; the pipetting analyzer hooks into these blocks. |
| CO-RE Gripper | #ffb86c | "CO-RE Grip" phrases | Plate movements handled by the gripper. Summaries list distinct grip events and barcodes. |
| Heater/Shaker (HSL) | #c678dd | "HSLHamHeaterShakerLib" | Heater or shaker operations with timestamps and USB node information. |
| System/Other | #8b949e | Fallback for anything else, including firmware chatter and initialization messages | Baseline system events. These often get collapsed when focusing on a particular task. |
Block summaries are generated per category:
- Pipetting blocks describe labware usage, well ranges, volume counts, and tip pick-up totals.
- CO-RE gripper blocks list unique moves and barcodes.
- Heater/Shaker blocks summarize operations, USB nodes, and time spans.
- Critical blocks display the generic "Critical event(s)" label so you catch them even when collapsed.
The first line of each block always remains visible. When you collapse a block the summary is inserted inline above that first line, indented so the original content stays aligned.
The viewer offers several mechanisms to control how much of the log you see at once.
- Focus filter: left-click a category name in the legend to emphasize it. All other categories are dimmed. Right-click any legend name or use
More... ? Clear Focusto restore the full palette. - Hide/Show: use the legend buttons to hide a category completely. Hidden categories stay collapsed until you click "Show this category".
- Collapse/Expand: collapse or expand a category from the legend, the bottom toolbar, or the
More...menu. - Collapsed stripes: when enabled (default), a narrow stripe in the gutter shows the color of collapsed sections so you can spot them while scrolling. Toggle with the Stripes button on the command bar or toolbar.
- Compact lines: reduces vertical spacing to fit more content on screen. Toggle using the Compact button on the command bar or bottom toolbar.
- Color summaries: toggles whether inline summaries inherit their category color. Turn it off when you want neutral summaries while still highlighting full blocks.
- Hover highlight: temporarily highlights the line under the mouse and draws the
+/-button in the gutter. Disable it from the command bar if you prefer static line numbers. - Focus-only summary colors: found under
More..., this option limits colored inline summaries to the focused category while dimming others.
All visibility settings are persisted in the .state.json file created next to the log.
Use the following tools to move around quickly.
- Scroll with the mouse wheel or trackpad. Holding
Shiftscrolls horizontally on most platforms. - Home/End jump to the start or end of the file. Page Up/Page Down move a screen at a time.
- Drag the vertical scrollbar thumb to fast-scroll; collapsed ranges still show their color stripe so you do not miss them.
- Select text with the mouse or by holding
Shiftand using the arrow keys. The status bar updates with timing information automatically.
- Press
Ctrl+=(orCtrl++),Ctrl+-, andCtrl+0to zoom in, zoom out, and reset. - The current font size is saved per log. The gutter font follows the body font so the layout stays tidy.
- Hover a line number to reveal a small button. A
+indicates a collapsed block,-indicates an expanded block. - Click the button to flip the block state.
- Collapsing a block reveals its inline summary if one exists; expanding removes the summary and restores the full text.
- Press
Ctrl+For clickFindon the command bar. - Enter a query. Toggle
Match case,Regex,Whole word, andSearch summariesas needed. - Use
Find Next (F3)andFind Prev (Shift+F3)to cycle through results. The current match is highlighted in a darker shade, while other hits stay marked. Find Allhighlights every match without moving the caret.Mark Alladds entire-line marks so you can scan for them. UseClear Marksto remove the markings.- Results honor the current focus and hidden categories to avoid revealing elided blocks unexpectedly.
- Press
Ctrl+Gor chooseGo Tofrom the command bar. - Specify either an absolute line number or a timestamp.
- Line numbers are clamped to the file range.
- Timestamps accept
HH:MM:SS(.ms)orYYYY-MM-DD HH:MM:SS(.ms).
- The viewer builds a per-line time index on load. When you go to a time it selects the best matching line, even within collapsed blocks (they are auto-expanded temporarily).
- Press
Ctrl+Por clickJumpin the command bar. - Start typing to filter by category, summary text, or trace content. The filter is order-sensitive: type
pipette a1to match blocks containing both terms in order. - Hit
Enteror double-click to jump to the block. The block expands if it was collapsed.
Ctrl+Aselects the entire document.- Hold
Shiftwith arrow keys or Page Up/Page Down to grow the selection. - The status bar reports selection length, time span, and pipetting summary if applicable.
- After using
Mark All, the viewer keeps a set of marked line numbers. They render with a subtle background tint. - You can mark different queries sequentially; the set is combined until you choose
Clear Marks.
Pipetting steps receive special handling so you can audit labware movements without parsing raw text.
- Automatic alignment: when a pipetting block loads, the viewer scans channel rows and pads labware, position, and volume columns so they line up. This keeps multi-channel runs readable even with varying field lengths.
- Inline highlighting: while blocks are visible, channel labware names use the
pipette_lab_fgcolor, aspirate positions usepipette_src_fg, dispense positions usepipette_dst_fg, and volumes usepipette_volume_fg. These subtle blues draw attention without overwhelming the primary category color. - Selection summaries: select one or more lines that include aspirate or dispense completions. The status bar shows a condensed summary such as
Pipetting: aspiratex3 from LabA, LabB inc OK (ch1-8); dispensex3 to LabC. - Detailed panel: press
Ctrl+Shift+Lto open a dedicated window for the current selection.- Select the block or lines you care about.
- Press
Ctrl+Shift+L. If no pipetting steps are present the status bar reports "Selection has no pipetting steps" and no window opens. - When a panel appears it lists the selection range and the same condensed summary at the top.
- Aspirate and dispense tables render side by side when both exist. Columns cover step number, log line, channel, labware, position, and volume.
- Scroll either table; the other stays in sync. Selecting a row in one table selects the matching row in the other thanks to guarded selection synchronization.
- Use the mouse wheel inside a table to scroll both simultaneously. Press
Escto close the panel; focus returns to the log automatically.
- Channel increment checks: the summary flags whether wells advance monotonically per channel.
inc OK (ch1-8)indicates continuous progress;inc mixed (ok ch1-4; stalled ch5-8)warns about channels that repeat positions. - Tip counts: summaries include
tips xNwhenever a tip pick-up event reports the number of channels involved.
If your selection does not include the complete lines for aspirate or dispense events, the analyzer returns "Selection has no pipetting steps"; expand the selection to include them.
The viewer surfaces multiple layers of feedback. Keep an eye on them to understand what the tool is doing.
- Metrics label: appears on the bottom toolbar's right side when the log contains timestamps. It shows
Totalduration (first timestamp to last) andw/o errors, which subtracts the span of blocks flagged asCritical. This helps answer "How much productive time did we get?" at a glance. - Status messages: the status bar below the toolbar reports the latest action, including load success, search hits, go-to results, selection spans, and pipetting summaries. Messages persist until another action writes a new one.
- Selection span readout: when you highlight text, the status message shows the elapsed time covered by the selection, the same span with critical blocks removed, start and end timestamps when available, and the number of lines selected.
- Pipetting summary snippet: selection summaries described in the previous section append to the same status line. This keeps timing and pipetting context together.
- Hover hints: hovering the gutter reveals the plus/minus button; hovering legend controls changes their background to confirm they are interactive.
| Action | Shortcut or interaction |
|---|---|
| Open file dialog | Ctrl+O |
| Reload current file | Ctrl+R |
| Zoom in / out / reset | Ctrl+= (or Ctrl++), Ctrl+-, Ctrl+0 |
| Find panel | Ctrl+F |
| Find next / previous | F3, Shift+F3 |
| Mark all matches | Find panel ? Mark All |
| Go To line/time | Ctrl+G |
| Jump to block palette | Ctrl+P |
| Toggle pipette selection panel | Ctrl+Shift+L |
| Toggle compact lines | Command bar ? Compact button |
| Toggle hover highlight | Command bar ? Hover button |
| Toggle colored summaries | Command bar ? Summaries button |
| Toggle collapsed stripes | Command bar ? Stripes button |
| Collapse/expand all blocks | Bottom toolbar buttons or Command bar More... menu |
| Focus on category | Left-click the category name in the legend |
| Clear focus | Right-click any category name or More... ? Clear Focus |
| Hide/Show category | Legend ? "Hide this category" / "Show this category" |
| Collapse/Expand category | Legend ? "Collapse this category" / "Expand this category" |
| Collapse/Expand single block | Hover gutter line number and click the +/- button |
| Copy selection | Ctrl+C (Cmd+C on macOS) |
| Close pipette panel | Esc |
Follow this guided tour with the bundled sample log to get comfortable with the tooling.
- Launch the viewer and open the sample file under
examples/. - Observe the legend. Click
Pipettingto focus on pipette activity. All other categories dim. - Click
Collapse Allon the bottom toolbar. Inline summaries appear so you can skim the run. - Use the scroll wheel to skim. When a summary looks interesting, hover its first line and click the
+button to expand just that block. - Press
Ctrl+Pand typecriticalto jump to the first critical block. Expand it to see the raw error messages. - With the critical block visible, drag to select the affected lines. Read the status bar: you will see the total time span, time excluding other critical blocks, and any pipetting summary if applicable.
- Move to a pipetting block using the jump palette or the legend controls. Select the entire block and press
Ctrl+Shift+Lto open the pipette panel. Scroll the aspirate and dispense tables to confirm they stay aligned. - Close the panel (
Esc), then pressCtrl+Fand search forBarcode. UseMark Allto highlight every occurrence, then scroll through the log to see where they cluster. - Clear marks, right-click the legend to clear focus, and toggle
Compactto see the full log with tighter spacing. - When you are done, press
Ctrl+Rto prove the log reloads cleanly without losing your current zoom and visibility settings.
You can tailor the viewer to your environment or data conventions.
- Edit
hslviewer/rules.py. - Each
CategoryRuletakesname,pattern,fgcolor, and optionalfont_kind("bold"or"italic"). - Patterns are Python regular expressions compiled with
re.IGNORECASE | re.MULTILINE. - Add new rules above
System/Otherso they take precedence. For example:CategoryRule("Maintenance", r"\bService\b", fg="#ffa657", font_kind="italic")
- Restart the viewer or press
Ctrl+Ron an open log to apply changes.
- Tweak colors in
hslviewer/theme.py. Tokens are grouped logically (backgrounds, foregrounds, pipette accents, treeview colors). - Keep contrast at comfortable levels for readability. The
apply_base_stylefunction configures ttk styles globally, so changes propagate automatically.
- Summaries live in
hslviewer/blocks.py. - Functions like
_summ_pipettingand_summ_corecan be adjusted to pull out different fields or wording. - Run
python scripts/dev_smoke.pyfor a quick sanity check after editing; it prints category assignments and summaries for a small sample.
hslviewer/pipetting.pyholds the data structures and parsing helpers.- Add new attributes to
PipettingChannelorPipettingEventif you need more context in the table. - The UI layer calls
_apply_pipette_highlightsand_format_sequence_summary; update those if you add new information.
- Remove the
.state.jsonfiles next to your logs to reset zoom, focus, and visibility preferences. - Delete
hamilton_log_highlighter.error.logif you want to clear old diagnostic messages.
All source files are typed and organized so that tests can be added later. Follow the standards in AGENTS.md if you plan on contributing code changes.
Produce a self-contained executable when you need to distribute the viewer to teammates who do not have Python installed.
- Activate your virtual environment (optional but recommended).
- Install PyInstaller if you have not already:
pip install pyinstaller. - Run the packaging helper:
python scripts/package_exe.py --mode onefile --name HSLViewer--mode onefilebundles everything into a single executable. Use--mode onedirfor a folder distribution.--namecontrols the executable name.--dist-dirand--build-dirlet you override the defaultdist/andbuild/directories if needed.
- Add
--cleanif you want the script to remove previous build artifacts before running. - On Windows the resulting executable appears under
dist/HSLViewer.exe. On macOS or Linux the filename has no extension; runchmod +x dist/HSLVieweronce to mark it executable. - Launch the packaged build to confirm it starts and can open logs. The same configuration files and error log are created next to the executable on first run.
ModuleNotFoundError: No module named '_tkinter': install tkinter for your platform (see the prerequisites) and rerun the script.- App does not start or immediately closes: check
hamilton_log_highlighter.error.logfor stack traces. The launcher writes detailed diagnostics there and shows a dialog with the path. - Log loads but nothing is colored: confirm the file uses newline characters the viewer can parse. Mixed line endings are handled, but extremely large single-line entries can exceed tkinter's rendering limits; split such lines or inspect them in a text editor.
- Performance feels sluggish on huge logs: collapse categories you do not need, disable hover highlight, and keep
Compacton. The viewer batches gutter redraws but still incurs work for millions of visible lines. - Wrong category classification: update the regex in
hslviewer/rules.pyor add a more specific rule above the generic ones. Reload the log after editing. - Pipette panel shows blank tables: ensure your selection includes the lines where the instrument reports
complete;for each step. Without those markers the analyzer cannot extract channels. - Need to reset preferences: delete the
*.state.jsonfile next to the log and restart the viewer. - Want console output: launch the app from a terminal with
python hamilton_log_highlighter.py --diagnosticsso print statements (for example the pipette sync trace) appear in the console.
hamilton_log_highlighter.py- entry script that bootstraps the tkinter app.hslviewer/- main package.app.py-HighlighterAppclass, UI wiring, state handling.blocks.py- classification helpers and block summarizers.rules.py- category definitions.search.py- find panel controller.pipetting.py- selection analyzer and data structures.panels.py- Go To dialog, jump palette, and outline hooks.theme.py- ttk theme tokens and style setup.ui/commandbar.py- command bar widget.state.py- load/save of per-log preferences.
examples/- sample trace log for practice.scripts/- helper scripts (package_exe.py,dev_smoke.py).todo/- engineering plans, roadmaps, and progress notes.AGENTS.md- engineering approach and collaboration standards.
- Review the documents under
todo/for performance, UI modernization, and rollout plans before making major changes. - Capture any future feature ideas or bug reports in
todo/progress_log.mdto keep the history aligned with the guidelines inAGENTS.md. - If you add new panels or instrumentation, remember the core principles: keep domain logic separate from UI glue, avoid blocking the Tk main loop, and favor small, well-typed functions.
With this guide you should be able to run HSLViewer, explore Hamilton logs confidently, and extend the tooling as your workflows evolve.