py2ls 0.1.8.5__py3-none-any.whl → 0.1.8.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
py2ls/ips.py
CHANGED
@@ -924,13 +924,14 @@ def pdf2img(dir_pdf, dir_save=None, page=None, kind="png", verbose=True, **kws):
|
|
924
924
|
page = [page]
|
925
925
|
if page is None:
|
926
926
|
page = [pdfinfo_from_path(dir_pdf)["Pages"]]
|
927
|
-
if len(page) == 1 and page != pdfinfo_from_path(dir_pdf)["Pages"]:
|
927
|
+
if len(page) == 1 and page != [pdfinfo_from_path(dir_pdf)["Pages"]]:
|
928
928
|
page = [page[0], page[0]]
|
929
929
|
else:
|
930
930
|
page = [1, page[0]]
|
931
|
-
|
931
|
+
print(page)
|
932
|
+
pages = convert_from_path(dir_pdf, first_page=page[0], last_page=page[-1], **kws)
|
932
933
|
if dir_save is None:
|
933
|
-
dir_save =
|
934
|
+
dir_save = mkdir(dirname(dir_pdf), basename(dir_pdf).split(".")[0] + "_img")
|
934
935
|
for i, page in enumerate(pages):
|
935
936
|
if verbose:
|
936
937
|
print(f"processing page: {i+1}")
|
py2ls/plot.py
CHANGED
@@ -333,18 +333,35 @@ def catplot(data, *args, **kwargs):
|
|
333
333
|
for i in df[x].unique().tolist():
|
334
334
|
for j in df[hue].unique().tolist():
|
335
335
|
xticklabels.append(i + "-" + j)
|
336
|
+
x_len = len(df[x].unique().tolist())
|
337
|
+
hue_len = len(df[hue].unique().tolist())
|
338
|
+
xticks = generate_xticks_with_gap(x_len, hue_len)
|
339
|
+
default_x_width = 0.85
|
336
340
|
else:
|
337
341
|
for i in df[x].unique().tolist():
|
338
342
|
xticklabels.append(i)
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
343
|
+
xticks = np.arange(1, len(xticklabels) + 1)
|
344
|
+
default_x_width = 0.5
|
345
|
+
# when the xticklabels are too long, rotate the labels a bit
|
346
|
+
|
347
|
+
xangle = 30 if max([len(i) for i in xticklabels]) > 5 else 0
|
348
|
+
if kw_figsets is not None:
|
349
|
+
kw_figsets = {
|
350
|
+
"ylabel": y,
|
351
|
+
"xlabel": x,
|
352
|
+
"xticks": xticks,
|
353
|
+
"xticklabels": xticklabels,
|
354
|
+
"xangle": xangle,
|
355
|
+
**kw_figsets,
|
356
|
+
}
|
357
|
+
else:
|
358
|
+
kw_figsets = {
|
359
|
+
"ylabel": y,
|
360
|
+
"xlabel": x,
|
361
|
+
"xticks": xticks,
|
362
|
+
"xticklabels": xticklabels,
|
363
|
+
"xangle": xangle,
|
364
|
+
}
|
348
365
|
|
349
366
|
# full_order
|
350
367
|
opt = kwargs.get("opt", {})
|
@@ -375,7 +392,7 @@ def catplot(data, *args, **kwargs):
|
|
375
392
|
|
376
393
|
opt.setdefault("loc", {})
|
377
394
|
opt["loc"].setdefault("go", 0)
|
378
|
-
opt["loc"].setdefault("xloc",
|
395
|
+
opt["loc"].setdefault("xloc", xticks)
|
379
396
|
|
380
397
|
# export setting
|
381
398
|
opt.setdefault("export", {})
|
@@ -394,7 +411,7 @@ def catplot(data, *args, **kwargs):
|
|
394
411
|
opt["b"].setdefault("EdgeAlpha", 1)
|
395
412
|
opt["b"].setdefault("LineStyle", "-")
|
396
413
|
opt["b"].setdefault("LineWidth", 0.8)
|
397
|
-
opt["b"].setdefault("x_width",
|
414
|
+
opt["b"].setdefault("x_width", default_x_width)
|
398
415
|
opt["b"].setdefault("ShowBaseLine", "off")
|
399
416
|
opt["b"].setdefault("hatch", None)
|
400
417
|
|
@@ -1507,3 +1524,26 @@ def df2array(data: pd.DataFrame, x, y, hue=None):
|
|
1507
1524
|
new_ = data.loc[(data[x] == x_) & (data[hue] == hue_), y].to_list()
|
1508
1525
|
a = padcat(a, new_, axis=0)
|
1509
1526
|
return sort_rows_move_nan(a.reshape(2 ** ((i + 1) * (j + 1)), -1))
|
1527
|
+
|
1528
|
+
|
1529
|
+
def generate_xticks_with_gap(x_len, hue_len):
|
1530
|
+
"""
|
1531
|
+
Generate a concatenated array based on x_len and hue_len,
|
1532
|
+
and return only the positive numbers.
|
1533
|
+
|
1534
|
+
Parameters:
|
1535
|
+
- x_len: int, number of segments to generate
|
1536
|
+
- hue_len: int, length of each hue
|
1537
|
+
|
1538
|
+
Returns:
|
1539
|
+
- numpy array: Concatenated array containing only positive numbers
|
1540
|
+
"""
|
1541
|
+
|
1542
|
+
arrays = [
|
1543
|
+
np.arange(1, hue_len + 1) + hue_len * (x_len - i) + (x_len - i)
|
1544
|
+
for i in range(max(x_len, hue_len), 0, -1) # i iterates from 3 to 1
|
1545
|
+
]
|
1546
|
+
concatenated_array = np.concatenate(arrays)
|
1547
|
+
positive_array = concatenated_array[concatenated_array > 0]
|
1548
|
+
|
1549
|
+
return positive_array
|
@@ -134,14 +134,14 @@ py2ls/db2ls.py,sha256=MMfFX47aIPIyu7fU9aPvX9lbPRPYOpJ_VXwlnWk-8qo,13615
|
|
134
134
|
py2ls/doc.py,sha256=xN3g1OWfoaGUhikbJ0NqbN5eKy1VZVvWwRlhHMgyVEc,4243
|
135
135
|
py2ls/export_requirements.py,sha256=x2WgUF0jYKz9GfA1MVKN-MdsM-oQ8yUeC6Ua8oCymio,2325
|
136
136
|
py2ls/freqanalysis.py,sha256=F4218VSPbgL5tnngh6xNCYuNnfR-F_QjECUUxrPYZss,32594
|
137
|
-
py2ls/ips.py,sha256=
|
137
|
+
py2ls/ips.py,sha256=6eNvNwaCDj2jyjter7VPL9oEGB2jS4ge9mSgiIrvZfo,100788
|
138
138
|
py2ls/netfinder.py,sha256=OMStrwMAASf1ajlyEfseoaEygo7G5WKBAFRE0LY15Lw,49477
|
139
|
-
py2ls/plot.py,sha256=
|
139
|
+
py2ls/plot.py,sha256=drlrWMUseSqkaTQHeTygypn39SUiovYuvThLQZ1Df_Y,55682
|
140
140
|
py2ls/setuptools-70.1.0-py3-none-any.whl,sha256=2bi3cUVal8ip86s0SOvgspteEF8SKLukECi-EWmFomc,882588
|
141
141
|
py2ls/sleep_events_detectors.py,sha256=bQA3HJqv5qnYKJJEIhCyhlDtkXQfIzqksnD0YRXso68,52145
|
142
142
|
py2ls/stats.py,sha256=Wd9yCKQ_61QD29WMEgMuEcreFxF91NmlPW65iWT2B5w,39041
|
143
143
|
py2ls/translator.py,sha256=bc5FB-wqC4TtQz9gyCP1mE38HqNRJ_pmuRIgKnAlMzM,30581
|
144
144
|
py2ls/wb_detector.py,sha256=7y6TmBUj9exCZeIgBAJ_9hwuhkDh1x_-yg4dvNY1_GQ,6284
|
145
|
-
py2ls-0.1.8.
|
146
|
-
py2ls-0.1.8.
|
147
|
-
py2ls-0.1.8.
|
145
|
+
py2ls-0.1.8.6.dist-info/METADATA,sha256=CCDGfjYmrUoLuYqvwidE8OkCBWs-EvCa5tviSzKVOjs,20017
|
146
|
+
py2ls-0.1.8.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
147
|
+
py2ls-0.1.8.6.dist-info/RECORD,,
|
File without changes
|