Skip to content

Commit

Permalink
- adds babel.numbers to hiddenimports for pyinstaller
Browse files Browse the repository at this point in the history
- fixes date rendering for some locales in scheduler and make it more robust
- upgrades to numpy 2.1 and scipy 1.14.0 and adjust type checkers
- updates some other libs
- fixes character issue in buttons definition of the Kalaido Legacy machine setup
- corrects some translations
  • Loading branch information
MAKOMO committed Aug 19, 2024
1 parent da454ff commit 4d39767
Show file tree
Hide file tree
Showing 71 changed files with 173,959 additions and 173,868 deletions.
4 changes: 2 additions & 2 deletions src/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.0</string>
<string>3.0.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -131,7 +131,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>Artisan 3.0.0</string>
<string>Artisan 3.0.1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSArchitecturePriority</key>
Expand Down
3 changes: 2 additions & 1 deletion src/artisan-linux.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ if not os.path.isdir(path):

hiddenimports_list=[
'matplotlib.backends.backend_pdf',
'matplotlib.backends.backend_svg'
'matplotlib.backends.backend_svg',
'babel.numbers'
]

a = Analysis(['artisan.py'],
Expand Down
2 changes: 1 addition & 1 deletion src/artisan-mac.spec
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ BINARIES.extend([(os.path.join(yocto_lib_path, fn),'yoctopuce/cdll') for fn in o
a = Analysis(['artisan.py'],
binaries=BINARIES,
datas=DATA_FILES,
hiddenimports=[],
hiddenimports=['babel.numbers'],
hookspath=[],
runtime_hooks=[],
excludes= [],
Expand Down
3 changes: 2 additions & 1 deletion src/artisan-win.spec
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ hiddenimports_list=['charset_normalizer.md__mypyc', # part of requests 2.28.2 #
'scipy._lib.messagestream',
'pywintypes',
'win32cred',
'win32timezone'
'win32timezone',
'babel.numbers'
]
# Add the hidden imports not required by legacy Windows.
if not ARTISAN_LEGACY=='True':
Expand Down
18 changes: 9 additions & 9 deletions src/artisanlib/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2991,14 +2991,14 @@ def onrelease(self, event:'Event') -> None: # NOTE: onrelease() is connected
bboxpatch = self.aw.analysisresultsanno.get_bbox_patch()
if bboxpatch is not None:
corners = self.ax.transAxes.inverted().transform(bboxpatch.get_extents())
self.analysisresultsloc = (corners[0][0], corners[0][1] + (corners[1][1] - corners[0][1])/2)
self.analysisresultsloc = (float(corners[0][0]), float(corners[0][1] + (corners[1][1] - corners[0][1])/2))
# save the location of segment results after dragging
if self.segmentpickflag and self.aw.segmentresultsanno is not None:
self.segmentpickflag = False
bbox_patch = self.aw.segmentresultsanno.get_bbox_patch()
if bbox_patch is not None:
corners = self.ax.transAxes.inverted().transform(bbox_patch.get_extents())
self.segmentresultsloc = (corners[0][0], corners[0][1] + (corners[1][1] - corners[0][1])/2)
self.segmentresultsloc = (float(corners[0][0]), float(corners[0][1] + (corners[1][1] - corners[0][1])/2))
except Exception as e: # pylint: disable=broad-except
_log.exception(e)
_, _, exc_tb = sys.exc_info()
Expand Down Expand Up @@ -3884,7 +3884,7 @@ def sample_processing(self, local_flagstart:bool, temp1_readings:List[float], te
with warnings.catch_warnings():
warnings.simplefilter('ignore')
# using stable polyfit from numpy polyfit module
LS_fit = numpy.polynomial.polynomial.polyfit(time_vec, temp_samples, 1) # type:ignore[no-untyped-call]
LS_fit = numpy.polynomial.polynomial.polyfit(time_vec, temp_samples, 1)
self.rateofchange1 = LS_fit[1]*60.
except Exception: # pylint: disable=broad-except
# a numpy/OpenBLAS polyfit bug can cause polyfit to throw an exception "SVD did not converge in Linear Least Squares" on Windows Windows 10 update 2004
Expand Down Expand Up @@ -3917,7 +3917,7 @@ def sample_processing(self, local_flagstart:bool, temp1_readings:List[float], te
temp_samples = sample_tstemp2[-left_index:]
with warnings.catch_warnings():
warnings.simplefilter('ignore')
LS_fit = numpy.polynomial.polynomial.polyfit(time_vec, temp_samples, 1) # type:ignore[no-untyped-call]
LS_fit = numpy.polynomial.polynomial.polyfit(time_vec, temp_samples, 1)
self.rateofchange2 = LS_fit[1]*60.
except Exception: # pylint: disable=broad-except
# a numpy/OpenBLAS polyfit bug can cause polyfit to throw an exception "SVD did not converge in Linear Least Squares" on Windows Windows 10 update 2004
Expand Down Expand Up @@ -6392,7 +6392,7 @@ def fmt_data(self, x:float) -> str:
try:
# depending on the z-order of ax vs delta_ax the one or the other one is correct
#res = (self.ax.transData.inverted().transform((0,self.delta_ax.transData.transform((0,x))[1]))[1])
res = (self.delta_ax.transData.inverted().transform((0,self.ax.transData.transform((0,x))[1]))[1])
res = float(self.delta_ax.transData.inverted().transform((0,self.ax.transData.transform((0,x))[1]))[1])
except Exception: # pylint: disable=broad-except
pass
if self.LCDdecimalplaces:
Expand Down Expand Up @@ -7475,7 +7475,7 @@ def polyRoR(tx:'npt.NDArray[numpy.double]', temp:'npt.NDArray[numpy.double]', ws
with warnings.catch_warnings():
warnings.simplefilter('ignore')
left_index = max(0,i-wsize)
LS_fit = numpy.polynomial.polynomial.polyfit(tx[left_index:i+1],temp[left_index:i+1], 1) # type:ignore[no-untyped-call]
LS_fit = numpy.polynomial.polynomial.polyfit(tx[left_index:i+1],temp[left_index:i+1], 1)
return float(LS_fit[1]*60.)
else:
return 0
Expand Down Expand Up @@ -7707,12 +7707,12 @@ def set_xlabel(self, xlabel:str) -> None:
pass

def setProfileBackgroundTitle(self, backgroundtitle:str) -> None:
suptitleX = 1
suptitleX:float = 1
try:
if self.ax is not None:
ax_width = self.ax.get_window_extent(renderer=self.fig.canvas.get_renderer()).width # type: ignore # total width of axis in display coordinates
ax_begin = self.ax.transAxes.transform((0,0))[0] # left of axis in display coordinates
suptitleX = self.fig.transFigure.inverted().transform((ax_width + ax_begin,0))[0]
suptitleX = float(self.fig.transFigure.inverted().transform((ax_width + ax_begin,0))[0])
except Exception: # pylint: disable=broad-except
pass

Expand Down Expand Up @@ -16478,7 +16478,7 @@ def on_pick(self, event:'PickEvent') -> None:
if isinstance(line, Line2D):
#identify which line is being edited
ydata = line.get_ydata()
if len(ydata)>1 and ydata[1] == self.temp1[1]: # type: ignore
if len(ydata)>1 and ydata[1] == self.temp1[1]:
self.workingline = 1
else:
self.workingline = 2
Expand Down
28 changes: 14 additions & 14 deletions src/artisanlib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4629,7 +4629,7 @@ def fit2str(fit:Optional['npt.NDArray[numpy.double]']) -> str:
sign = '+'
fit = fit[::-1]
try:
for i, fiti in enumerate(fit):
for i, fiti in enumerate(fit): # type:ignore[reportArgumentType, unused-ignore] # pyright falsly reports since numpy 2.1: Argument of type "Unknown | None" cannot be assigned to parameter "iterable" of type "Iterable

Check failure on line 4632 in src/artisanlib/main.py

View workflow job for this annotation

GitHub Actions / codespell

falsly ==> falsely
v = abs(fiti)
if round(v,3) != 0.0:
if i == 0:
Expand Down Expand Up @@ -6555,8 +6555,8 @@ def digitize(self, v:float, ls:'npt.NDArray[numpy.double]', coarse:int, i:int) -
factor = 10
elif coarse == 2: # slider step size 5
factor = 5
r = float(((numpy.digitize([v],ls)[0] - 1) * factor + self.eventslidermin[i]) / 10.)
return max(self.eventslidermin[i]/10., min(self.eventslidermax[i] / 10.,r))
r = float(((numpy.digitize([v],ls)[0] - 1) * factor + self.eventslidermin[i]) / 10.) # type:ignore[index] # mypy (on numpy 2.1): "signedinteger[_64Bit]" is not indexable [index]
return max(self.eventslidermin[i]/10., min(self.eventslidermax[i] / 10., r))

def curveSimilarity2(self,exp:int=-1,analysis_starttime:float=0,analysis_endtime:float=0) -> 'CurveSimilarity': # pylint: disable=no-self-use
result:CurveSimilarity = {
Expand Down Expand Up @@ -6634,8 +6634,8 @@ def replNone(a:'npt.NDArray[numpy.double]', nv:'npt.NDArray[numpy.int64]') -> 'n
raise ValueError('Length of np_dbtb is zero')

#MSE
mse_BT = numpy.mean(numpy.square(np_bt - np_btb))
mse_deltaBT = numpy.mean(numpy.square(np_dbt - np_dbtb))
mse_BT = float(numpy.mean(numpy.square(np_bt - np_btb)))
mse_deltaBT = float(numpy.mean(numpy.square(np_dbt - np_dbtb)))

# RMSE
rmse_BT = numpy.sqrt(mse_BT)
Expand Down Expand Up @@ -6765,7 +6765,7 @@ def replNone(a:'npt.NDArray[numpy.double]', nv:'npt.NDArray[numpy.int64]') -> 'n
segment_mse_deltas = numpy.append(segment_mse_deltas, numpy.mean(numpy.square(segment_deltas)))
segment_times = times_all[ss:ss+lengths_seg[i]+1]
try:
tra = numpy.trapezoid(segment_abs_deltas, x=segment_times) # type:ignore [attr-defined]
tra = numpy.trapezoid(segment_abs_deltas, x=segment_times)
except Exception: # pylint: disable=broad-except
tra = numpy.trapz(segment_abs_deltas, x=segment_times) # type:ignore [attr-defined, unused-ignore]
segment_abc_deltas = numpy.append(segment_abc_deltas, tra)
Expand All @@ -6778,11 +6778,11 @@ def replNone(a:'npt.NDArray[numpy.double]', nv:'npt.NDArray[numpy.int64]') -> 'n
ioi_abs_deltas = numpy.absolute(deltas_all)
ioi_maxdelta = deltas_all[numpy.asarray(ioi_abs_deltas == numpy.amax(ioi_abs_deltas)).nonzero()[0][0]]
try:
tra = numpy.trapezoid(ioi_abs_deltas, x=times_all) # type:ignore [attr-defined]
tra = numpy.trapezoid(ioi_abs_deltas, x=times_all)
except Exception: # pylint: disable=broad-except
tra = numpy.trapz(ioi_abs_deltas, x=times_all) # type:ignore [attr-defined, unused-ignore]
ioi_abc_deltas = numpy.sum(tra)
ioi_abcprime = ioi_abc_deltas / ioi_seconds
ioi_abc_deltas = float(numpy.sum(tra))
ioi_abcprime = str(ioi_abc_deltas / ioi_seconds)

# fit RoR in C/min/min
if exp == 2:
Expand Down Expand Up @@ -15121,7 +15121,7 @@ def setProfile(self, filename:Optional[str], profile:'ProfileData', quiet:bool =
axis_to_data = self.qmc.ax.transAxes + self.qmc.ax.transData.inverted()
data_to_axis = axis_to_data.inverted()
pos = data_to_axis.transform(legendloc_pos_data)
self.qmc.legendloc_pos = (pos[0],pos[1])
self.qmc.legendloc_pos = (float(pos[0]),float(pos[1]))
self.qmc.legend = None
except Exception as e: # pylint: disable=broad-except
_log.exception(e)
Expand Down Expand Up @@ -15269,15 +15269,15 @@ def ndec(num:float) -> int:
# Calculate the average number of decimals in an array of floats
ndec_arr = numpy.array([ndec(x) for x in bt])
avgDecimal = numpy.average(ndec_arr)
maxDecimal = numpy.amax(ndec_arr)
maxDecimal = float(numpy.amax(ndec_arr))

# Calculate the resolution from the BT values
# Sort the numbers in ascending order
# Calculate the differences between successive numbers
# Find the smallest non-zero difference
# Exception if there are no non-zero differences
try:
resolution = numpy.min(numpy.diff(numpy.sort(bt))[numpy.nonzero(numpy.diff(numpy.sort(bt)))])
resolution = float(numpy.min(numpy.diff(numpy.sort(bt))[numpy.nonzero(numpy.diff(numpy.sort(bt)))]))
except Exception: # pylint: disable=broad-except
resolution = float('nan')

Expand All @@ -15293,8 +15293,8 @@ def ndec(num:float) -> int:
# Count skipped samples (missing timex)
tx_diff = numpy.diff(tx)
avg_sample = float(numpy.average(tx_diff))
longest_sample = numpy.max(tx_diff)
shortest_sample = numpy.min(tx_diff)
longest_sample = float(numpy.max(tx_diff))
shortest_sample = float(numpy.min(tx_diff))
skipped_sample_time = 1.5*avg_sample
skipped = numpy.count_nonzero(tx_diff > skipped_sample_time)
bins = [0, 1*profile_sampling_interval, 1.5*profile_sampling_interval, 4*profile_sampling_interval, 9999]
Expand Down
2 changes: 1 addition & 1 deletion src/includes/Machines/Kaleido/Legacy.aset
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ extraeventsactions=1, 1, 0, 1, 1, 0, 1, 1, 0, 20, 20, 0, 1, 1, 0, 0, 1, 1, 1, 1,
extraeventsactionstrings="OT1,UP", "OT1,DOWN", , "OT2,UP", "OT2,DOWN", , "HPM,A", "HPM,M", , PIDon, PIDoff, , "CLDN,ON", "CLDN,OFF", , , "OT1,{}", "OT1,{}", "OT1,{}", "OT1,{}", "OT1,{}", "OT1,{}", "OT1,{}", "OT1,{}", "OT1,{}", "OT1,{}", "OT1,{}", , "OT2,{}", "OT2,{}", "OT2,{}", "OT2,{}", "OT2,{}", "OT2,{}", , "IO3,{}", "IO3,{}", "IO3,{}", "IO3,{}", "IO3,{}", "IO3,{}", "IO3,{}"
extraeventsbuttonsflags=0, 1, 1
extraeventsdescriptions=, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
extraeventslabels=+5%\n\\t, -5%\n\\t, , +5%\n\\t, -5%\n\\t, , AUTO\nPower, MANUAL\nPower, , \\1\nHeating, \\0\nHeating, , \\1\x1\nCooling, @String(\\0\0\nCooling), , , 100%\n\\t, 90%\n\\t, 80%\n\\t, 70%\n\\t, 60%\n\\t, 50%\n\\t, 40%\n\\t, 30%\n\\t, 20%\n\\t, 10%\n\\t, \\0\n\\t, , 60%\n\\t, 50%\n\\t, 40%\n\\t, 30%\n\\t, 20%\n\\t, \\0\n\\t, , 100%\n\\t, 90%\n\\t, 80%\n\\t, 70%\n\\t, 60%\n\\t, 50%\n\\t, \\0\n\\t
extraeventslabels=+5%\n\\t, -5%\n\\t, , +5%\n\\t, -5%\n\\t, , AUTO\nPower, MANUAL\nPower, , \\1\nHeating, \\0\nHeating, , \\1\nCooling, \\0\nCooling, , , 100%\n\\t, 90%\n\\t, 80%\n\\t, 70%\n\\t, 60%\n\\t, 50%\n\\t, 40%\n\\t, 30%\n\\t, 20%\n\\t, 10%\n\\t, \\0\n\\t, , 60%\n\\t, 50%\n\\t, 40%\n\\t, 30%\n\\t, 20%\n\\t, \\0\n\\t, , 100%\n\\t, 90%\n\\t, 80%\n\\t, 70%\n\\t, 60%\n\\t, 50%\n\\t, \\0\n\\t
extraeventstypes=8, 8, 4, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1
extraeventsvalues=1.5, -1.5, 1.5, 1.5, -1.5, 1.5, 1, 1, 1.5, 1.5, 2, 1.5, 1, 1, 1, 1, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 7, 6, 5, 4, 3, 1, 1, 11, 10, 9, 8, 7, 6, 1
extraeventsvisibility=1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1
Expand Down
Loading

0 comments on commit 4d39767

Please sign in to comment.