Skip to content

Commit d7ceec5

Browse files
committed
bump to version 0.0.13, reformat details attribution
1 parent 2dc7a88 commit d7ceec5

File tree

3 files changed

+37
-12
lines changed

3 files changed

+37
-12
lines changed

cli/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ build-backend = "setuptools.build_meta"
1515

1616
[project]
1717
name = "xyfigure"
18-
version = "0.0.12"
18+
version = "0.0.13"
1919
authors = [
2020
{ name="Chad Hovey", email="chovey@sandia.gov" },
2121
]
@@ -29,7 +29,7 @@ classifiers = [
2929
"Operating System :: OS Independent",
3030
]
3131
dependencies = [
32-
"black", "flake8", "matplotlib", "pytest", "pytest-cov", "pyyaml", "scipy"
32+
"black", "flake8", "matplotlib", "pytest", "pytest-cov", "pyyaml", "scipy", "tzlocal"
3333
]
3434

3535
# Entry Points

cli/src/xyfigure/xyview.py

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
# standard library imports
33
import os
44
from datetime import datetime
5+
from pathlib import Path
6+
import socket
57

68
# related third-party imports
79
import matplotlib.pyplot as plt
810
from PIL import Image
9-
from pathlib import Path
11+
from tzlocal import get_localzone
1012

1113
# local application/library specific imports
1214
# from xyfigure.xybase import XYBase
@@ -186,11 +188,15 @@ def figure(self):
186188
# https://github.com/matplotlib/matplotlib/issues/3173
187189
# https://matplotlib.org/3.1.1/tutorials/intermediate/imshow_extent.html
188190
bounds = [left, right, bottom, top]
189-
im = ax.imshow(im, zorder=0, extent=bounds, alpha=al, aspect="auto")
191+
im = ax.imshow(
192+
im, zorder=0, extent=bounds, alpha=al, aspect="auto"
193+
)
190194

191195
for model in self._models:
192196
# needs rearchitecting, a logview descends from a view
193-
if self._xaxislog and not self._yaxislog: # needs rearchitecting
197+
if (
198+
self._xaxislog and not self._yaxislog
199+
): # needs rearchitecting
194200
ax.semilogx(model.x, model.y, **model.plot_kwargs)
195201
elif not self._xaxislog and self._yaxislog:
196202
ax.semilogy(model.x, model.y, **model.plot_kwargs)
@@ -249,14 +255,31 @@ def figure(self):
249255
ax.legend()
250256

251257
if self._details:
252-
now = datetime.now()
253-
now_str = now.strftime("%Y-%m-%d %H:%M:%S")
258+
# Get the local timezone
259+
local_timezone = get_localzone()
260+
261+
# Get the current time in the local timezone
262+
current_time = datetime.now(local_timezone)
263+
264+
# Format the date and time stamp
265+
timestamp = current_time.strftime("%Y-%m-%d %H:%M:%S %Z%z")
266+
254267
user = str(os.getlogin())
255-
host = str(os.getenv("HOSTNAME"))
268+
# host = str(os.getenv("HOSTNAME"))
269+
host = socket.gethostname()
256270
details_str = (
257-
self._file + " created " + now_str + " by " + user + " on " + host
271+
self._file
272+
+ " created "
273+
+ timestamp
274+
+ " by "
275+
+ user
276+
+ " on "
277+
+ host
278+
)
279+
280+
ax.set_title(
281+
details_str, fontsize=8, ha="center", color="dimgray"
258282
)
259-
ax.set_title(details_str, fontsize=10, ha="center", color="dimgray")
260283

261284
if self._display:
262285
plt.show()
@@ -346,7 +369,9 @@ def figure(self):
346369
xs, ys, _ = zip(*model._nodes)
347370

348371
for face in model._elements:
349-
xf = tuple(xs[k - 1] for k in face) # 1-base index to 0-base index
372+
xf = tuple(
373+
xs[k - 1] for k in face
374+
) # 1-base index to 0-base index
350375
yf = tuple(ys[k - 1] for k in face)
351376
# plt.fill(
352377
# xf,

geo/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ build-backend = "setuptools.build_meta"
1313

1414
[project]
1515
name = "ptg"
16-
version = "0.0.12"
16+
version = "0.0.13"
1717
authors = [
1818
{ name="Chad Hovey", email="chovey@sandia.gov" },
1919
]

0 commit comments

Comments
 (0)