py2ls 0.1.2__tar.gz → 0.1.3__tar.gz
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-0.1.3/PKG-INFO +432 -0
- py2ls-0.1.3/py2ls/README.md +420 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/pyproject.toml +1 -1
- py2ls-0.1.2/PKG-INFO +0 -12
- py2ls-0.1.2/README.md +0 -0
- {py2ls-0.1.2/py2ls → py2ls-0.1.3}/README.md +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/COMMIT_EDITMSG +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/FETCH_HEAD +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/HEAD +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/config +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/description +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/applypatch-msg.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/commit-msg.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/fsmonitor-watchman.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/post-update.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/pre-applypatch.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/pre-commit.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/pre-merge-commit.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/pre-push.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/pre-rebase.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/pre-receive.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/prepare-commit-msg.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/push-to-checkout.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/hooks/update.sample +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/index +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/info/exclude +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/logs/HEAD +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/logs/refs/heads/main +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/logs/refs/remotes/origin/HEAD +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/logs/refs/remotes/origin/main +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/14/449a0e6ba4ea2f1a73acf63ef91c9c6193f9ed +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/15/a8e468aacfcb440e090020f36d0b985d45da23 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/25/b796accd261b9135fd32a2c00785f68edf6c46 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/30/a2f8da47ee947811dc8d993f5a06a45de374f4 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/36/b4a1b7403abc6c360f8fe2cb656ab945254971 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/36/ef43e50009e59db11812c258846d9e38718173 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/3f/d6561300938afbb3d11976cf9c8f29549280d9 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/58/20a729045d4dc7e37ccaf8aa8eec126850afe2 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/60/f273eb1c412d916fa3f11318a7da7a9911b52a +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/61/570cec8c061abe74121f27f5face6c69b98f99 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/69/13c452ca319f7cbf6a0836dc10a5bb033c84e4 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/78/3d4167bc95c9d2175e0df03ef1c1c880ba75ab +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/79/7ae089b2212a937840e215276005ce76881307 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/7e/5956c806b5edc344d46dab599dec337891ba1f +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/8e/55a7d2b96184030211f20c9b9af201eefcac82 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/91/c69ad88fe0ba94aa7859fb5f7edac5e6f1a3f7 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/9d/0df52899fe95279059286d9c0ec42287edc168 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/a5/ec8f74642fbba27f7ea78c53b372ae0c7dedce +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/b0/56be4be89ba6b76949dd641df45bb7036050c8 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/b0/9cd7856d58590578ee1a4f3ad45d1310a97f87 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/b2/18e6a0f0f1c4df8cdefa9852058348abc713b7 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/d9/005f2cc7fc4e65f14ed5518276007c08cf2fd0 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/d9/c2403fd166ce791b4e9d0c6792ed8342c71fcd +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/df/e0770424b2a19faf507a501ebfc23be8f54e7b +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/e3/5a4dafc50850cacac7bf76c56db2715cbda2c4 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/e9/391ffe371f1cc43b42ef09b705d9c767c2e14f +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/objects/fc/292e793ecfd42240ac43be407023bd731fa9e7 +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/refs/heads/main +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/refs/remotes/origin/HEAD +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.git/refs/remotes/origin/main +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.gitattributes +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/.gitignore +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/LICENSE +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/__init__.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/brain_atlas.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/correlators.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/dbhandler.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/freqanalysis.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/internet_finder.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/ips.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/netfinder.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/sleep_events_detectors.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/translator.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/version.py +0 -0
- {py2ls-0.1.2 → py2ls-0.1.3}/py2ls/wb_detector.py +0 -0
py2ls-0.1.3/PKG-INFO
ADDED
@@ -0,0 +1,432 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: py2ls
|
3
|
+
Version: 0.1.3
|
4
|
+
Summary:
|
5
|
+
Author: Jianfeng
|
6
|
+
Author-email: Jianfeng.Liu0413@gmail.com
|
7
|
+
Requires-Python: >=3.12,<4.0
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
10
|
+
Description-Content-Type: text/markdown
|
11
|
+
|
12
|
+
# Install
|
13
|
+
|
14
|
+
```python
|
15
|
+
pip install py2ls
|
16
|
+
```
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
# ips
|
21
|
+
|
22
|
+
### listdir, basename, dirname, newfolder, finfo
|
23
|
+
|
24
|
+
e.g.,
|
25
|
+
|
26
|
+
```python
|
27
|
+
fpath = "....../"
|
28
|
+
ips.listdir(fpath, kind='pdf', sort_by="size", ascending=0, output = 'df')
|
29
|
+
```
|
30
|
+
|
31
|
+
it filters the ‘.pdf’ files, and sort by the (file-size/name, length of name, create_time, mod_time, last_open_time …) it returns a DataFrame or BoxList (setting by ‘output’)
|
32
|
+
|
33
|
+
```python
|
34
|
+
dir_data, dir_fig = newfolder(fpath, {'data', 'fig'}) # create folder
|
35
|
+
```
|
36
|
+
|
37
|
+
```python
|
38
|
+
finfo(fpath) # get info: size, creation time, mod time, parent_path, fname, kind...
|
39
|
+
```
|
40
|
+
|
41
|
+
```python
|
42
|
+
dir_lib(lib_of_interest) # get the fpath
|
43
|
+
```
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
### list_func/func_list (same)
|
48
|
+
|
49
|
+
list functions in a package
|
50
|
+
|
51
|
+
### fload, fsave, figsave
|
52
|
+
|
53
|
+
e.g.,
|
54
|
+
|
55
|
+
```python
|
56
|
+
fload(fpath, kind=None, **kwargs)
|
57
|
+
```
|
58
|
+
|
59
|
+
load file (docx, pdf, image, md, json,csv,txt, html, yaml, xml, xlsx…) or save file.
|
60
|
+
|
61
|
+
```python
|
62
|
+
# figsave, as used in matlab.
|
63
|
+
figsave(dir_save, "fname.pdf", dpi=300)
|
64
|
+
```
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
### pdf2img, img2pdf, docx2pdf
|
69
|
+
|
70
|
+
extract images from a PDF, or merge images into a pdf file
|
71
|
+
|
72
|
+
```python
|
73
|
+
pdf2img(dir_pdf, dir_save=None, page=None, kind="png",verbose=True, **kws)
|
74
|
+
pdf2img(fpath, page=[None, None]) # means extract all pages
|
75
|
+
# processing page: 1
|
76
|
+
# processing page: 2
|
77
|
+
# processing page: 3
|
78
|
+
# processing page: 4
|
79
|
+
# processing page: 5
|
80
|
+
|
81
|
+
```
|
82
|
+
|
83
|
+
```python
|
84
|
+
img2pdf(dir_img, kind="jpeg",page=None, dir_save=None, page_size="a4", dpi=300)
|
85
|
+
```
|
86
|
+
|
87
|
+
```python
|
88
|
+
docx2pdf(dir_docx, dir_save) # convert docx to pdf
|
89
|
+
```
|
90
|
+
|
91
|
+
### paper_size
|
92
|
+
|
93
|
+
quickly get the size info
|
94
|
+
|
95
|
+
```python
|
96
|
+
paper_size('a4') # [210, 297]
|
97
|
+
paper_size('card') # [85.6, 53.98]
|
98
|
+
```
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
### str2num, num2str, str2list
|
103
|
+
|
104
|
+
e.g.,
|
105
|
+
|
106
|
+
```python
|
107
|
+
str2num(“123.345 dollers”,2)# => 123.35 (float)
|
108
|
+
```
|
109
|
+
|
110
|
+
```python
|
111
|
+
str2list("abcd") # ['a','b','c','d']
|
112
|
+
```
|
113
|
+
|
114
|
+
```python
|
115
|
+
list2str(x_str)
|
116
|
+
```
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
### ssplit, sreplace
|
121
|
+
|
122
|
+
```python
|
123
|
+
sreplace(text, dict_replace=None, robust=True)
|
124
|
+
```
|
125
|
+
|
126
|
+
```python
|
127
|
+
ssplit(text, by="space", verbose=False, **kws) # by = "word", "sentence", ", ","num_strings","digital".....,"length", "upper followed lower", "lower followed upper"
|
128
|
+
```
|
129
|
+
|
130
|
+
```python
|
131
|
+
text = "The most pronounced physiological changes in sleep occur in the brain.[10] The brain uses significantly less energy during sleep than it does when awake, especially during non-REM sleep. In areas with reduced activity, the brain restores its supply of adenosine triphosphate (ATP), the molecule used for short-term storage and transport of energy.[11] In quiet waking, the brain is responsible for 20% of the body's energy use, thus this reduction has a noticeable effect on overall energy consumption.[12]"
|
132
|
+
ssplit(text, by=["[10]", "[11]", "[12]"])
|
133
|
+
# ['The most pronounced physiological changes in sleep occur in the brain.',
|
134
|
+
# ' The brain uses significantly less energy during sleep than it does when awake, especially during non-REM sleep. In areas with reduced activity, the brain restores its supply of adenosine triphosphate (ATP), the molecule used for short-term storage and transport of energy.',
|
135
|
+
# " In quiet waking, the brain is responsible for 20% of the body's energy use, thus this reduction has a noticeable effect on overall energy consumption.",
|
136
|
+
# '']
|
137
|
+
```
|
138
|
+
|
139
|
+
```python
|
140
|
+
ssplit(text[:30], by="len", length=5)
|
141
|
+
# ['The m', 'ost p', 'ronou', 'nced ', 'physi', 'ologi']
|
142
|
+
```
|
143
|
+
|
144
|
+
```python
|
145
|
+
ssplit(text, by="non_alphanumeric")
|
146
|
+
# ['The most pronounced physiological changes in sleep occur in the brain.[',
|
147
|
+
# '10',
|
148
|
+
# '] The brain uses significantly less energy during sleep than it does when awake, especially during non-REM sleep. In areas with reduced activity, the brain restores its supply of adenosine triphosphate (ATP), the molecule used for short-term storage and transport of energy.[',
|
149
|
+
# '11',
|
150
|
+
# '] In quiet waking, the brain is responsible for ',
|
151
|
+
# '20',
|
152
|
+
# "% of the body's energy use, thus this reduction has a noticeable effect on overall energy consumption.[",
|
153
|
+
# '12',
|
154
|
+
# ']']
|
155
|
+
```
|
156
|
+
|
157
|
+
```python
|
158
|
+
ssplit(text, by="sent")
|
159
|
+
#['The most pronounced physiological changes in sleep occur in the brain.',
|
160
|
+
#'[10] The brain uses significantly less energy during sleep than it does when awake, especially during non-REM sleep.',
|
161
|
+
#'In areas with reduced activity, the brain restores its supply of adenosine triphosphate (ATP), the molecule used for short-term storage and transport of energy.',
|
162
|
+
#"[11] In quiet waking, the brain is responsible for 20% of the body's energy use, thus this reduction has a noticeable effect on overall energy consumption.",
|
163
|
+
#'[12]']
|
164
|
+
```
|
165
|
+
|
166
|
+
```python
|
167
|
+
ssplit(text, by="lowup")
|
168
|
+
# ["The most pronounced physiological changes in sleep occur in the brain.[10] The brain uses significantly less energy during sleep than it does when awake, especially during non-REM sleep. In areas with reduced activity, the brain restores its supply of adenosine triphosphate (ATP), the molecule used for short-term storage and transport of energy.[11] In quiet waking, the brain is responsible for 20% of the body's energy use, thus this reduction has a noticeable effect on overall energy consumption.[12]"]
|
169
|
+
|
170
|
+
```
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
### stats
|
175
|
+
|
176
|
+
#### **FuncCmpt** ( two groups cmp)
|
177
|
+
|
178
|
+
```python
|
179
|
+
FuncCmpt(X1, X2, pmc='auto', pair='unpaired')
|
180
|
+
```
|
181
|
+
|
182
|
+
#### FuncMultiCmpt ( multiple groups cmp)
|
183
|
+
|
184
|
+
```python
|
185
|
+
FuncMultiCmpt(pmc='pmc', pair='unpair', data=None, dv=None, factor=None,
|
186
|
+
ss_type=2, detailed=True, effsize='np2',
|
187
|
+
correction='auto', between=None, within=None,
|
188
|
+
subject=None, group=None
|
189
|
+
)
|
190
|
+
```
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
#### FuncStars
|
195
|
+
|
196
|
+
```python
|
197
|
+
FuncStars(ax,
|
198
|
+
pval=None,
|
199
|
+
Ylim=None,
|
200
|
+
Xlim=None,
|
201
|
+
symbol='*',
|
202
|
+
yscale=0.95,
|
203
|
+
x1=0,
|
204
|
+
x2=1,
|
205
|
+
alpha=0.05,
|
206
|
+
fontsize=14,
|
207
|
+
fontsize_note=6,
|
208
|
+
rotation=0,
|
209
|
+
fontname='Arial',
|
210
|
+
values_below=None,
|
211
|
+
linego=True,
|
212
|
+
linestyle='-',
|
213
|
+
linecolor='k',
|
214
|
+
linewidth=.8,
|
215
|
+
nsshow='off',
|
216
|
+
symbolcolor='k',
|
217
|
+
tailindicator=[0.06, 0.06],
|
218
|
+
report=None,
|
219
|
+
report_scale=-0.1,
|
220
|
+
report_loc=None)
|
221
|
+
```
|
222
|
+
|
223
|
+
### plots
|
224
|
+
|
225
|
+
#### stdshade
|
226
|
+
|
227
|
+
```python
|
228
|
+
stdshade(ax=None,*args, **kwargs)
|
229
|
+
```
|
230
|
+
|
231
|
+
#### add_colorbar
|
232
|
+
|
233
|
+
```python
|
234
|
+
add_colorbar(im, width=None, pad=None, **kwargs)
|
235
|
+
```
|
236
|
+
|
237
|
+
#### get_color
|
238
|
+
|
239
|
+
```python
|
240
|
+
get_color(n=1, cmap='auto')
|
241
|
+
```
|
242
|
+
|
243
|
+
```python
|
244
|
+
get_color(12)
|
245
|
+
# ['#474747',
|
246
|
+
# '#FF2C00',
|
247
|
+
# '#0C5DA5',
|
248
|
+
# '#845B97',
|
249
|
+
# '#58BBCC',
|
250
|
+
# '#FF9500',
|
251
|
+
# '#D57DBE',
|
252
|
+
# '#474747',
|
253
|
+
# '#FF2C00',
|
254
|
+
# '#0C5DA5',
|
255
|
+
# '#845B97',
|
256
|
+
# '#58BBCC']
|
257
|
+
```
|
258
|
+
|
259
|
+
```python
|
260
|
+
get_color(5, cmap="jet") # ['#000080', '#000084', '#000089', '#00008d', '#000092']
|
261
|
+
get_color(5,cmap="rainbow") #['#8000ff', '#7e03ff', '#7c06ff', '#7a09ff', '#780dff']
|
262
|
+
```
|
263
|
+
|
264
|
+
#### img appearance
|
265
|
+
|
266
|
+
#### imgsets
|
267
|
+
|
268
|
+
```python
|
269
|
+
imgsets(
|
270
|
+
img,
|
271
|
+
sets=None,
|
272
|
+
show=True,
|
273
|
+
show_axis=False,
|
274
|
+
size=None,
|
275
|
+
dpi=100,
|
276
|
+
figsize=None,
|
277
|
+
auto=False,
|
278
|
+
filter_kws=None,
|
279
|
+
)
|
280
|
+
```
|
281
|
+
|
282
|
+
```python
|
283
|
+
img = imgsets(
|
284
|
+
fpath,
|
285
|
+
sets={"rota": -5, "sharp": 10},
|
286
|
+
dpi=200,
|
287
|
+
# show_axis=True,
|
288
|
+
)
|
289
|
+
figsave(dir_save, "test1_sharp.pdf")
|
290
|
+
|
291
|
+
|
292
|
+
img2 = imgsets(
|
293
|
+
fpath,
|
294
|
+
sets={"rota": -5, "crop": [100, 100, 300, 400], "sharp": 10},
|
295
|
+
dpi=200,
|
296
|
+
filter_kws={
|
297
|
+
"sharpen": 10,
|
298
|
+
},
|
299
|
+
# show_axis=True,
|
300
|
+
)
|
301
|
+
figsave(dir_save, "test2_crop.pdf")
|
302
|
+
```
|
303
|
+
|
304
|
+
```python
|
305
|
+
fload(dir_img)
|
306
|
+
```
|
307
|
+
|
308
|
+

|
309
|
+
|
310
|
+
```python
|
311
|
+
imgsets(img, sets={"color": 1.5}, show=0)
|
312
|
+
```
|
313
|
+
|
314
|
+

|
315
|
+
|
316
|
+
```python
|
317
|
+
imgsets(img, sets={"pad": (300, 300), "bgcolor": (73, 162, 127)}, show=0)
|
318
|
+
```
|
319
|
+
|
320
|
+

|
321
|
+
|
322
|
+
```python
|
323
|
+
imgsets(
|
324
|
+
img,
|
325
|
+
sets={"contrast": 1.3, "color": 1.5, "pad": (300, 300)},
|
326
|
+
show=0,
|
327
|
+
filter_kws=dict(sh=1050, EDG=10, gaus=5),
|
328
|
+
)
|
329
|
+
```
|
330
|
+
|
331
|
+

|
332
|
+
|
333
|
+
```python
|
334
|
+
imgsets(
|
335
|
+
img,
|
336
|
+
sets={"color": 10.5},
|
337
|
+
show=0,
|
338
|
+
filter_kws=dict(EDGE_ENHANCE=50, EDGE_NHANCEmore=50),
|
339
|
+
)
|
340
|
+
```
|
341
|
+
|
342
|
+

|
343
|
+
|
344
|
+
```python
|
345
|
+
imgsets(
|
346
|
+
img,
|
347
|
+
sets=dict(contr=1.5, rm="default"),
|
348
|
+
show=0,
|
349
|
+
# filter_kws=dict(sharp=1),
|
350
|
+
)
|
351
|
+
```
|
352
|
+
|
353
|
+

|
354
|
+
|
355
|
+
```python
|
356
|
+
imgsets(
|
357
|
+
img,
|
358
|
+
sets=dict(contr=0, rm="default"),
|
359
|
+
show=0,
|
360
|
+
filter_kws=dict(sharp=1),
|
361
|
+
)
|
362
|
+
```
|
363
|
+
|
364
|
+

|
365
|
+
|
366
|
+
#### figsets
|
367
|
+
|
368
|
+
```python
|
369
|
+
figsets(*args)
|
370
|
+
```
|
371
|
+
|
372
|
+
```python
|
373
|
+
cm = 1 / 2.54
|
374
|
+
# plt.style.use("paper")
|
375
|
+
plt.figure(figsize=[8 * cm, 5 * cm])
|
376
|
+
for i in range(2, 4):
|
377
|
+
plt.plot(x, y * i, ls="-")
|
378
|
+
figsets(
|
379
|
+
plt.gca(),
|
380
|
+
{
|
381
|
+
"xlabel": f"time([{x[0]}:{x[-1]}])",
|
382
|
+
"ylabel": "Amplitude (signals)",
|
383
|
+
# "titel": "paper",
|
384
|
+
"xlim": [0, 600],
|
385
|
+
"xtick": np.arange(0, 620, 150),
|
386
|
+
"xlabel": "test xticklabel",
|
387
|
+
# "ylim": [-2.5, 2.5],
|
388
|
+
"sp": "go",
|
389
|
+
# "style": "paper",
|
390
|
+
"box": ":",
|
391
|
+
"grid": "on",
|
392
|
+
"minorticks": "on",
|
393
|
+
"ticks": {"c": "k"},
|
394
|
+
},
|
395
|
+
)
|
396
|
+
figsets('style','paper')
|
397
|
+
```
|
398
|
+
|
399
|
+
```python
|
400
|
+
cm = 1/2.54 # centimeters in inches
|
401
|
+
fig, ax = plt.subplots(1, 1, figsize=(7*cm, 5*cm))
|
402
|
+
x = np.linspace(0, 2 * np.pi, 50) * 100
|
403
|
+
y = np.sin(x)
|
404
|
+
c=get_color(7)
|
405
|
+
|
406
|
+
for i in range(2,7):
|
407
|
+
plt.plot(x, y*i,c=c[i])
|
408
|
+
figsets(
|
409
|
+
ax,
|
410
|
+
{
|
411
|
+
"xlim": [0, 450],
|
412
|
+
# "ylim": [-1.5, 1.5],
|
413
|
+
"xlabel": "2222",
|
414
|
+
# "style":"paper",
|
415
|
+
"yticks": np.arange(-5,5, 2),
|
416
|
+
"ylabel": "ylabelsssss",
|
417
|
+
"xtkbel": range(0, 800, 100),
|
418
|
+
# "spine": 5,
|
419
|
+
"suptitle": "supertitle",
|
420
|
+
# "minorticks": "y",
|
421
|
+
# "ticksloc":"lt",
|
422
|
+
# "ticks": {"direction": "out",'c':'b'},
|
423
|
+
"rotation":45,
|
424
|
+
# 'box':"lt",
|
425
|
+
# "labellocation":'r',
|
426
|
+
# "ax_color":'b',
|
427
|
+
# 'grid':{"which":'minor','lw':1,"ls":'-.','c':'b','al':0.3},
|
428
|
+
},
|
429
|
+
)
|
430
|
+
```
|
431
|
+
|
432
|
+
|
@@ -0,0 +1,420 @@
|
|
1
|
+
# Install
|
2
|
+
|
3
|
+
```python
|
4
|
+
pip install py2ls
|
5
|
+
```
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
# ips
|
10
|
+
|
11
|
+
### listdir, basename, dirname, newfolder, finfo
|
12
|
+
|
13
|
+
e.g.,
|
14
|
+
|
15
|
+
```python
|
16
|
+
fpath = "....../"
|
17
|
+
ips.listdir(fpath, kind='pdf', sort_by="size", ascending=0, output = 'df')
|
18
|
+
```
|
19
|
+
|
20
|
+
it filters the ‘.pdf’ files, and sort by the (file-size/name, length of name, create_time, mod_time, last_open_time …) it returns a DataFrame or BoxList (setting by ‘output’)
|
21
|
+
|
22
|
+
```python
|
23
|
+
dir_data, dir_fig = newfolder(fpath, {'data', 'fig'}) # create folder
|
24
|
+
```
|
25
|
+
|
26
|
+
```python
|
27
|
+
finfo(fpath) # get info: size, creation time, mod time, parent_path, fname, kind...
|
28
|
+
```
|
29
|
+
|
30
|
+
```python
|
31
|
+
dir_lib(lib_of_interest) # get the fpath
|
32
|
+
```
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
### list_func/func_list (same)
|
37
|
+
|
38
|
+
list functions in a package
|
39
|
+
|
40
|
+
### fload, fsave, figsave
|
41
|
+
|
42
|
+
e.g.,
|
43
|
+
|
44
|
+
```python
|
45
|
+
fload(fpath, kind=None, **kwargs)
|
46
|
+
```
|
47
|
+
|
48
|
+
load file (docx, pdf, image, md, json,csv,txt, html, yaml, xml, xlsx…) or save file.
|
49
|
+
|
50
|
+
```python
|
51
|
+
# figsave, as used in matlab.
|
52
|
+
figsave(dir_save, "fname.pdf", dpi=300)
|
53
|
+
```
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
### pdf2img, img2pdf, docx2pdf
|
58
|
+
|
59
|
+
extract images from a PDF, or merge images into a pdf file
|
60
|
+
|
61
|
+
```python
|
62
|
+
pdf2img(dir_pdf, dir_save=None, page=None, kind="png",verbose=True, **kws)
|
63
|
+
pdf2img(fpath, page=[None, None]) # means extract all pages
|
64
|
+
# processing page: 1
|
65
|
+
# processing page: 2
|
66
|
+
# processing page: 3
|
67
|
+
# processing page: 4
|
68
|
+
# processing page: 5
|
69
|
+
|
70
|
+
```
|
71
|
+
|
72
|
+
```python
|
73
|
+
img2pdf(dir_img, kind="jpeg",page=None, dir_save=None, page_size="a4", dpi=300)
|
74
|
+
```
|
75
|
+
|
76
|
+
```python
|
77
|
+
docx2pdf(dir_docx, dir_save) # convert docx to pdf
|
78
|
+
```
|
79
|
+
|
80
|
+
### paper_size
|
81
|
+
|
82
|
+
quickly get the size info
|
83
|
+
|
84
|
+
```python
|
85
|
+
paper_size('a4') # [210, 297]
|
86
|
+
paper_size('card') # [85.6, 53.98]
|
87
|
+
```
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
### str2num, num2str, str2list
|
92
|
+
|
93
|
+
e.g.,
|
94
|
+
|
95
|
+
```python
|
96
|
+
str2num(“123.345 dollers”,2)# => 123.35 (float)
|
97
|
+
```
|
98
|
+
|
99
|
+
```python
|
100
|
+
str2list("abcd") # ['a','b','c','d']
|
101
|
+
```
|
102
|
+
|
103
|
+
```python
|
104
|
+
list2str(x_str)
|
105
|
+
```
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
### ssplit, sreplace
|
110
|
+
|
111
|
+
```python
|
112
|
+
sreplace(text, dict_replace=None, robust=True)
|
113
|
+
```
|
114
|
+
|
115
|
+
```python
|
116
|
+
ssplit(text, by="space", verbose=False, **kws) # by = "word", "sentence", ", ","num_strings","digital".....,"length", "upper followed lower", "lower followed upper"
|
117
|
+
```
|
118
|
+
|
119
|
+
```python
|
120
|
+
text = "The most pronounced physiological changes in sleep occur in the brain.[10] The brain uses significantly less energy during sleep than it does when awake, especially during non-REM sleep. In areas with reduced activity, the brain restores its supply of adenosine triphosphate (ATP), the molecule used for short-term storage and transport of energy.[11] In quiet waking, the brain is responsible for 20% of the body's energy use, thus this reduction has a noticeable effect on overall energy consumption.[12]"
|
121
|
+
ssplit(text, by=["[10]", "[11]", "[12]"])
|
122
|
+
# ['The most pronounced physiological changes in sleep occur in the brain.',
|
123
|
+
# ' The brain uses significantly less energy during sleep than it does when awake, especially during non-REM sleep. In areas with reduced activity, the brain restores its supply of adenosine triphosphate (ATP), the molecule used for short-term storage and transport of energy.',
|
124
|
+
# " In quiet waking, the brain is responsible for 20% of the body's energy use, thus this reduction has a noticeable effect on overall energy consumption.",
|
125
|
+
# '']
|
126
|
+
```
|
127
|
+
|
128
|
+
```python
|
129
|
+
ssplit(text[:30], by="len", length=5)
|
130
|
+
# ['The m', 'ost p', 'ronou', 'nced ', 'physi', 'ologi']
|
131
|
+
```
|
132
|
+
|
133
|
+
```python
|
134
|
+
ssplit(text, by="non_alphanumeric")
|
135
|
+
# ['The most pronounced physiological changes in sleep occur in the brain.[',
|
136
|
+
# '10',
|
137
|
+
# '] The brain uses significantly less energy during sleep than it does when awake, especially during non-REM sleep. In areas with reduced activity, the brain restores its supply of adenosine triphosphate (ATP), the molecule used for short-term storage and transport of energy.[',
|
138
|
+
# '11',
|
139
|
+
# '] In quiet waking, the brain is responsible for ',
|
140
|
+
# '20',
|
141
|
+
# "% of the body's energy use, thus this reduction has a noticeable effect on overall energy consumption.[",
|
142
|
+
# '12',
|
143
|
+
# ']']
|
144
|
+
```
|
145
|
+
|
146
|
+
```python
|
147
|
+
ssplit(text, by="sent")
|
148
|
+
#['The most pronounced physiological changes in sleep occur in the brain.',
|
149
|
+
#'[10] The brain uses significantly less energy during sleep than it does when awake, especially during non-REM sleep.',
|
150
|
+
#'In areas with reduced activity, the brain restores its supply of adenosine triphosphate (ATP), the molecule used for short-term storage and transport of energy.',
|
151
|
+
#"[11] In quiet waking, the brain is responsible for 20% of the body's energy use, thus this reduction has a noticeable effect on overall energy consumption.",
|
152
|
+
#'[12]']
|
153
|
+
```
|
154
|
+
|
155
|
+
```python
|
156
|
+
ssplit(text, by="lowup")
|
157
|
+
# ["The most pronounced physiological changes in sleep occur in the brain.[10] The brain uses significantly less energy during sleep than it does when awake, especially during non-REM sleep. In areas with reduced activity, the brain restores its supply of adenosine triphosphate (ATP), the molecule used for short-term storage and transport of energy.[11] In quiet waking, the brain is responsible for 20% of the body's energy use, thus this reduction has a noticeable effect on overall energy consumption.[12]"]
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
### stats
|
164
|
+
|
165
|
+
#### **FuncCmpt** ( two groups cmp)
|
166
|
+
|
167
|
+
```python
|
168
|
+
FuncCmpt(X1, X2, pmc='auto', pair='unpaired')
|
169
|
+
```
|
170
|
+
|
171
|
+
#### FuncMultiCmpt ( multiple groups cmp)
|
172
|
+
|
173
|
+
```python
|
174
|
+
FuncMultiCmpt(pmc='pmc', pair='unpair', data=None, dv=None, factor=None,
|
175
|
+
ss_type=2, detailed=True, effsize='np2',
|
176
|
+
correction='auto', between=None, within=None,
|
177
|
+
subject=None, group=None
|
178
|
+
)
|
179
|
+
```
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
#### FuncStars
|
184
|
+
|
185
|
+
```python
|
186
|
+
FuncStars(ax,
|
187
|
+
pval=None,
|
188
|
+
Ylim=None,
|
189
|
+
Xlim=None,
|
190
|
+
symbol='*',
|
191
|
+
yscale=0.95,
|
192
|
+
x1=0,
|
193
|
+
x2=1,
|
194
|
+
alpha=0.05,
|
195
|
+
fontsize=14,
|
196
|
+
fontsize_note=6,
|
197
|
+
rotation=0,
|
198
|
+
fontname='Arial',
|
199
|
+
values_below=None,
|
200
|
+
linego=True,
|
201
|
+
linestyle='-',
|
202
|
+
linecolor='k',
|
203
|
+
linewidth=.8,
|
204
|
+
nsshow='off',
|
205
|
+
symbolcolor='k',
|
206
|
+
tailindicator=[0.06, 0.06],
|
207
|
+
report=None,
|
208
|
+
report_scale=-0.1,
|
209
|
+
report_loc=None)
|
210
|
+
```
|
211
|
+
|
212
|
+
### plots
|
213
|
+
|
214
|
+
#### stdshade
|
215
|
+
|
216
|
+
```python
|
217
|
+
stdshade(ax=None,*args, **kwargs)
|
218
|
+
```
|
219
|
+
|
220
|
+
#### add_colorbar
|
221
|
+
|
222
|
+
```python
|
223
|
+
add_colorbar(im, width=None, pad=None, **kwargs)
|
224
|
+
```
|
225
|
+
|
226
|
+
#### get_color
|
227
|
+
|
228
|
+
```python
|
229
|
+
get_color(n=1, cmap='auto')
|
230
|
+
```
|
231
|
+
|
232
|
+
```python
|
233
|
+
get_color(12)
|
234
|
+
# ['#474747',
|
235
|
+
# '#FF2C00',
|
236
|
+
# '#0C5DA5',
|
237
|
+
# '#845B97',
|
238
|
+
# '#58BBCC',
|
239
|
+
# '#FF9500',
|
240
|
+
# '#D57DBE',
|
241
|
+
# '#474747',
|
242
|
+
# '#FF2C00',
|
243
|
+
# '#0C5DA5',
|
244
|
+
# '#845B97',
|
245
|
+
# '#58BBCC']
|
246
|
+
```
|
247
|
+
|
248
|
+
```python
|
249
|
+
get_color(5, cmap="jet") # ['#000080', '#000084', '#000089', '#00008d', '#000092']
|
250
|
+
get_color(5,cmap="rainbow") #['#8000ff', '#7e03ff', '#7c06ff', '#7a09ff', '#780dff']
|
251
|
+
```
|
252
|
+
|
253
|
+
#### img appearance
|
254
|
+
|
255
|
+
#### imgsets
|
256
|
+
|
257
|
+
```python
|
258
|
+
imgsets(
|
259
|
+
img,
|
260
|
+
sets=None,
|
261
|
+
show=True,
|
262
|
+
show_axis=False,
|
263
|
+
size=None,
|
264
|
+
dpi=100,
|
265
|
+
figsize=None,
|
266
|
+
auto=False,
|
267
|
+
filter_kws=None,
|
268
|
+
)
|
269
|
+
```
|
270
|
+
|
271
|
+
```python
|
272
|
+
img = imgsets(
|
273
|
+
fpath,
|
274
|
+
sets={"rota": -5, "sharp": 10},
|
275
|
+
dpi=200,
|
276
|
+
# show_axis=True,
|
277
|
+
)
|
278
|
+
figsave(dir_save, "test1_sharp.pdf")
|
279
|
+
|
280
|
+
|
281
|
+
img2 = imgsets(
|
282
|
+
fpath,
|
283
|
+
sets={"rota": -5, "crop": [100, 100, 300, 400], "sharp": 10},
|
284
|
+
dpi=200,
|
285
|
+
filter_kws={
|
286
|
+
"sharpen": 10,
|
287
|
+
},
|
288
|
+
# show_axis=True,
|
289
|
+
)
|
290
|
+
figsave(dir_save, "test2_crop.pdf")
|
291
|
+
```
|
292
|
+
|
293
|
+
```python
|
294
|
+
fload(dir_img)
|
295
|
+
```
|
296
|
+
|
297
|
+

|
298
|
+
|
299
|
+
```python
|
300
|
+
imgsets(img, sets={"color": 1.5}, show=0)
|
301
|
+
```
|
302
|
+
|
303
|
+

|
304
|
+
|
305
|
+
```python
|
306
|
+
imgsets(img, sets={"pad": (300, 300), "bgcolor": (73, 162, 127)}, show=0)
|
307
|
+
```
|
308
|
+
|
309
|
+

|
310
|
+
|
311
|
+
```python
|
312
|
+
imgsets(
|
313
|
+
img,
|
314
|
+
sets={"contrast": 1.3, "color": 1.5, "pad": (300, 300)},
|
315
|
+
show=0,
|
316
|
+
filter_kws=dict(sh=1050, EDG=10, gaus=5),
|
317
|
+
)
|
318
|
+
```
|
319
|
+
|
320
|
+

|
321
|
+
|
322
|
+
```python
|
323
|
+
imgsets(
|
324
|
+
img,
|
325
|
+
sets={"color": 10.5},
|
326
|
+
show=0,
|
327
|
+
filter_kws=dict(EDGE_ENHANCE=50, EDGE_NHANCEmore=50),
|
328
|
+
)
|
329
|
+
```
|
330
|
+
|
331
|
+

|
332
|
+
|
333
|
+
```python
|
334
|
+
imgsets(
|
335
|
+
img,
|
336
|
+
sets=dict(contr=1.5, rm="default"),
|
337
|
+
show=0,
|
338
|
+
# filter_kws=dict(sharp=1),
|
339
|
+
)
|
340
|
+
```
|
341
|
+
|
342
|
+

|
343
|
+
|
344
|
+
```python
|
345
|
+
imgsets(
|
346
|
+
img,
|
347
|
+
sets=dict(contr=0, rm="default"),
|
348
|
+
show=0,
|
349
|
+
filter_kws=dict(sharp=1),
|
350
|
+
)
|
351
|
+
```
|
352
|
+
|
353
|
+

|
354
|
+
|
355
|
+
#### figsets
|
356
|
+
|
357
|
+
```python
|
358
|
+
figsets(*args)
|
359
|
+
```
|
360
|
+
|
361
|
+
```python
|
362
|
+
cm = 1 / 2.54
|
363
|
+
# plt.style.use("paper")
|
364
|
+
plt.figure(figsize=[8 * cm, 5 * cm])
|
365
|
+
for i in range(2, 4):
|
366
|
+
plt.plot(x, y * i, ls="-")
|
367
|
+
figsets(
|
368
|
+
plt.gca(),
|
369
|
+
{
|
370
|
+
"xlabel": f"time([{x[0]}:{x[-1]}])",
|
371
|
+
"ylabel": "Amplitude (signals)",
|
372
|
+
# "titel": "paper",
|
373
|
+
"xlim": [0, 600],
|
374
|
+
"xtick": np.arange(0, 620, 150),
|
375
|
+
"xlabel": "test xticklabel",
|
376
|
+
# "ylim": [-2.5, 2.5],
|
377
|
+
"sp": "go",
|
378
|
+
# "style": "paper",
|
379
|
+
"box": ":",
|
380
|
+
"grid": "on",
|
381
|
+
"minorticks": "on",
|
382
|
+
"ticks": {"c": "k"},
|
383
|
+
},
|
384
|
+
)
|
385
|
+
figsets('style','paper')
|
386
|
+
```
|
387
|
+
|
388
|
+
```python
|
389
|
+
cm = 1/2.54 # centimeters in inches
|
390
|
+
fig, ax = plt.subplots(1, 1, figsize=(7*cm, 5*cm))
|
391
|
+
x = np.linspace(0, 2 * np.pi, 50) * 100
|
392
|
+
y = np.sin(x)
|
393
|
+
c=get_color(7)
|
394
|
+
|
395
|
+
for i in range(2,7):
|
396
|
+
plt.plot(x, y*i,c=c[i])
|
397
|
+
figsets(
|
398
|
+
ax,
|
399
|
+
{
|
400
|
+
"xlim": [0, 450],
|
401
|
+
# "ylim": [-1.5, 1.5],
|
402
|
+
"xlabel": "2222",
|
403
|
+
# "style":"paper",
|
404
|
+
"yticks": np.arange(-5,5, 2),
|
405
|
+
"ylabel": "ylabelsssss",
|
406
|
+
"xtkbel": range(0, 800, 100),
|
407
|
+
# "spine": 5,
|
408
|
+
"suptitle": "supertitle",
|
409
|
+
# "minorticks": "y",
|
410
|
+
# "ticksloc":"lt",
|
411
|
+
# "ticks": {"direction": "out",'c':'b'},
|
412
|
+
"rotation":45,
|
413
|
+
# 'box':"lt",
|
414
|
+
# "labellocation":'r',
|
415
|
+
# "ax_color":'b',
|
416
|
+
# 'grid':{"which":'minor','lw':1,"ls":'-.','c':'b','al':0.3},
|
417
|
+
},
|
418
|
+
)
|
419
|
+
```
|
420
|
+
|
py2ls-0.1.2/PKG-INFO
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: py2ls
|
3
|
-
Version: 0.1.2
|
4
|
-
Summary:
|
5
|
-
Author: Jianfeng
|
6
|
-
Author-email: Jianfeng.Liu0413@gmail.com
|
7
|
-
Requires-Python: >=3.12,<4.0
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
9
|
-
Classifier: Programming Language :: Python :: 3.12
|
10
|
-
Description-Content-Type: text/markdown
|
11
|
-
|
12
|
-
|
py2ls-0.1.2/README.md
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|