Skip to content

Commit a898a6f

Browse files
committed
Merge branch 'dev/dc' into dev/dr
# Conflicts: # pychron/dvc/tasks/actions.py
2 parents 1d8a723 + 502e7d1 commit a898a6f

File tree

223 files changed

+12340
-2095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+12340
-2095
lines changed

.github/workflows/hardwaredocs.yml .github/workflows/wikidocs.yml

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Hardware Docs
1+
name: Wiki Docs
22
on:
33
pull_request:
44
branches: [dev/dc, hot/dc]
55
push:
66
branches: [dev/dc, hot/dc]
77
jobs:
8-
build_hardware_docs:
9-
name: Build hardware docs (${{ matrix.python-version }}, ${{ matrix.os }})
8+
build_wiki_docs:
9+
name: Build wiki docs (${{ matrix.python-version }}, ${{ matrix.os }})
1010
strategy:
1111
matrix:
1212
os: [ macos-latest ]
@@ -32,20 +32,27 @@ jobs:
3232
scipy sqlalchemy traits xlrd xlsxwriter xlwt pytest statsmodels
3333
- name: Install PIP dependencies
3434
run: >
35-
~/.edm/envs/edm/bin/python -m pip install --no-dependencies uncertainties qimage2ndarray peakutils
36-
- name: build docs
35+
~/.edm/envs/edm/bin/python -m pip install --no-dependencies uncertainties qimage2ndarray peakutils lazydocs
36+
- name: build hardware docs
3737
run: |
38-
~/.edm/envs/edm/bin/python pychron/hardwaredocs.py
38+
~/.edm/envs/edm/bin/python pychron/docs_hardware.py
3939
- name: copy to temp
4040
run: cp pychron/hardwaredocs.md /Users/runner/work/hardwaredocs.md
41+
- name: build pyscript docs
42+
run: |
43+
~/.edm/envs/edm/bin/python pychron/docs_pyscript.py
44+
- name: copy to temp
45+
run: cp pychron/pyscriptdocs.md /Users/runner/work/pyscriptdocs.md
4146
- name: fetch wiki
4247
uses: actions/checkout@v2
4348
with:
4449
repository: NMGRL/pychron.wiki
4550
set-safe-directory: /Users/runner/work/pychron.wiki
46-
- name: copy to wiki
51+
- name: copy hardware to wiki
4752
run: cp /Users/runner/work/hardwaredocs.md ./Available-Hardware.md
53+
- name: copy pyscript to wiki
54+
run: cp /Users/runner/work/pyscriptdocs.md ./Pyscript-API.md
4855
- name: Commit changes
4956
uses: stefanzweifel/[email protected]
5057
with:
51-
commit_message: built hardware docs
58+
commit_message: built wiki docs

launchers/helpers.py

+74
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,79 @@ def sizeHint(self, option, index):
306306
checkbox_renderer.CheckboxRenderer = CheckboxRenderer
307307

308308

309+
def monkey_patch_table_view():
310+
from traitsui.qt4.table_editor import TableView
311+
312+
def sizeHint(self):
313+
size_hint = QtGui.QTableView.sizeHint(self)
314+
315+
# This method is sometimes called by Qt after the editor has been
316+
# disposed but before this control has been deleted:
317+
if self._editor.factory is None:
318+
return size_hint
319+
320+
try:
321+
width = self.style().pixelMetric(
322+
QtGui.QStyle.PixelMetric.PM_ScrollBarExtent, QtGui.QStyleOptionHeader(), self
323+
)
324+
except AttributeError:
325+
width = 100
326+
327+
for column in range(len(self._editor.columns)):
328+
width += self.sizeHintForColumn(column)
329+
330+
size_hint.setWidth(int(width))
331+
return size_hint
332+
333+
def resizeColumnsToContents(self):
334+
"""Support proportional column width specifications."""
335+
336+
# TODO: The proportional size specification approach found in the
337+
# TableColumns is not entirely compatible with the ability to
338+
# specify the resize_mode. Namely, there are combinations of
339+
# specifications that are redundant, and others which are
340+
# contradictory. Rework this method so that the various values
341+
# for **width** have a well-defined, sensible meaning for each
342+
# of the possible values of resize_mode.
343+
344+
editor = self._editor
345+
available_space = self.viewport().width()
346+
hheader = self.horizontalHeader()
347+
348+
# Compute sizes for columns with absolute or no size requests
349+
proportional = []
350+
for column_index in range(len(editor.columns)):
351+
column = editor.columns[column_index]
352+
requested_width = column.get_width()
353+
if (
354+
column.resize_mode in ("interactive", "stretch")
355+
and 0 < requested_width <= 1.0
356+
):
357+
proportional.append((column_index, requested_width))
358+
elif (
359+
column.resize_mode == "interactive"
360+
and requested_width < 0
361+
and self._initial_size
362+
):
363+
# Keep previous size if initial sizing has been done
364+
available_space -= hheader.sectionSize(column_index)
365+
else:
366+
base_width = hheader.sectionSizeHint(column_index)
367+
width = int(max(base_width, self.sizeHintForColumn(column_index)))
368+
hheader.resizeSection(column_index, width)
369+
available_space -= width
370+
371+
# Now use the remaining space for columns with proportional width
372+
# requests
373+
for column_index, percent in proportional:
374+
base_width = hheader.sectionSizeHint(column_index)
375+
width = int(max(base_width, int(percent * available_space)))
376+
hheader.resizeSection(column_index, width)
377+
378+
TableView.resizeColumnsToContents = resizeColumnsToContents
379+
TableView.sizeHint = sizeHint
380+
381+
309382
KLASS_MAP = {'pyexperiment': 'PyExperiment',
310383
'pyview': 'PyView',
311384
'pyvalve': 'PyValve',
@@ -324,6 +397,7 @@ def entry_point(appname, debug=False):
324397
monkey_patch_preferences()
325398
monkey_patch_checkbox_render()
326399
monkey_patch_panel()
400+
monkey_patch_table_view()
327401

328402
# set_stylesheet('darkorange.css')
329403
env = initialize_version(appname, debug)

pychron/applications/about_dialog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from pyface.qt.QtGui import QPlainTextEdit
2222

2323
# ============= enthought library imports =======================
24-
from pyface.ui.qt4.about_dialog import AboutDialog
24+
from pyface.about_dialog import AboutDialog
2525
from traits.api import List, Str
2626

2727
# ============= local library imports ==========================

pychron/bakeout/__init__.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ===============================================================================
2+
# Copyright 2024 ross
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ===============================================================================
16+
17+
# ============= EOF =============================================

pychron/bakeout/bakeout_manager.py

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# ===============================================================================
2+
# Copyright 2024 ross
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ===============================================================================
16+
from traits.api import Any
17+
from traitsui.api import UItem, TableEditor, InstanceEditor, HGroup
18+
from traitsui.table_column import ObjectColumn
19+
from traitsui.extras.checkbox_column import CheckboxColumn
20+
21+
from pychron.graph.time_series_graph import TimeSeriesStreamStackedGraph
22+
from pychron.hardware.bakeout_plc import BakeoutPLC
23+
from pychron.loggable import Loggable
24+
from pychron.managers.stream_graph_manager import StreamGraphManager
25+
26+
27+
class BakeoutManager(StreamGraphManager):
28+
controller = Any
29+
settings_name = "bakeout_streaming"
30+
31+
def _create_manager(
32+
self, klass, manager, params, port=None, host=None, remote=False
33+
):
34+
return self.application.get_service(BakeoutManager)
35+
36+
def _controller_default(self):
37+
return BakeoutPLC(name="controller", configuration_dir_name="bakeout")
38+
39+
def prepare_destroy(self):
40+
self.set_streaming_active(False)
41+
self.stop_scan()
42+
self.controller.prepare_destroy()
43+
44+
def activate(self):
45+
self.debug("asdfascasdcasdc")
46+
self.set_streaming_active(True)
47+
# self.bind_preferences()
48+
49+
# self.load_event_marker_config()
50+
self.setup_scan()
51+
# self.readout_view.start()
52+
self.reset_scan_timer()
53+
54+
def setup_scan(self):
55+
self._reset_graph()
56+
self.graph_scan_width = 10
57+
self._graph_scan_width_changed()
58+
59+
def _update_scan_graph(self):
60+
for ci in self.get_display_channels():
61+
t = self.controller.read_temperature(ci.index)
62+
if t is None:
63+
continue
64+
65+
sp = self.controller.read_setpoint(ci.index)
66+
dc = self.controller.read_duty_cycle(ci.index)
67+
self.controller.read_overtemp_ishighhigh(ci.index)
68+
69+
self.graph.record(t, series=ci.index)
70+
self.graph.record(sp, series=ci.index + 1)
71+
self.graph.record(dc, plotid=1, series=ci.index)
72+
73+
def _graph_factory(self, *args, **kw):
74+
g = TimeSeriesStreamStackedGraph()
75+
# g.plotcontainer.padding_top = 5
76+
# g.plotcontainer.padding_right = 5
77+
g.new_plot(
78+
xtitle="Time (s)",
79+
ytitle="Temp. (C)",
80+
padding_top=5,
81+
padding_left=75,
82+
padding_right=5,
83+
show_legend="ul",
84+
)
85+
g.set_scan_width(600, plotid=0)
86+
g.set_data_limits(1.8 * 600, plotid=0)
87+
88+
# Output/Duty Cycle
89+
g.new_plot(
90+
ytitle="Output/Duty Cycle (%)",
91+
padding_top=5,
92+
padding_left=75,
93+
padding_right=5,
94+
)
95+
96+
g.set_scan_width(600, plotid=1)
97+
g.set_data_limits(1.8 * 600, plotid=1)
98+
g.set_y_limits(min_=-2, max_=102, plotid=1)
99+
for channel in self.controller.channels:
100+
series, _ = g.new_series(
101+
plotid=0, color=channel.color, name=channel.shortname
102+
)
103+
g.new_series(
104+
plotid=0,
105+
# render_style="connectedhold",
106+
line_style="dash",
107+
color=series.color,
108+
name=f"{channel.shortname}, Setpoint",
109+
)
110+
111+
g.new_series(plotid=1, name=channel.shortname, color=series.color)
112+
113+
return g
114+
115+
def get_display_channels(self):
116+
return [ci for ci in self.controller.channels if ci.display]
117+
118+
119+
if __name__ == "__main__":
120+
b = BakeoutManager()
121+
b.activate()
122+
b.setup_scan()
123+
124+
# ============= EOF =============================================

pychron/bakeout/tasks/__init__.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ===============================================================================
2+
# Copyright 2024 ross
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# ===============================================================================
16+
17+
# ============= EOF =============================================

0 commit comments

Comments
 (0)