datastock 0.0.50__py3-none-any.whl → 0.0.52__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.
@@ -420,7 +420,20 @@ def _check_vectbasis(
420
420
  e2=None,
421
421
  dim=None,
422
422
  tol=None,
423
+ direct=None,
423
424
  ):
425
+ """ Check a 2d or 3d set of unit vectors
426
+
427
+ Check that:
428
+ - vectors are defined (if None, they can be inferred)
429
+
430
+ Normalizes vectorto be unit vectors
431
+ Optionally (default) check the vectors forma direct basis
432
+ """
433
+
434
+ # ----------------
435
+ # check inputs
436
+ # ----------------
424
437
 
425
438
  # dim
426
439
  dim = _check_var(dim, 'dim', types=int, default=3, allowed=[2, 3])
@@ -428,6 +441,13 @@ def _check_vectbasis(
428
441
  # tol
429
442
  tol = _check_var(tol, 'tol', types=float, default=1.e-14, sign='>0.')
430
443
 
444
+ # direct
445
+ direct = _check_var(direct, 'direct', types=bool, default=True)
446
+
447
+ # ----------------------
448
+ # check what's provided
449
+ # ----------------------
450
+
431
451
  # check is provided
432
452
  if e0 is not None:
433
453
  e0 = _check_flat1darray(e0, 'e0', size=dim, dtype=float, norm=True)
@@ -436,13 +456,23 @@ def _check_vectbasis(
436
456
  if e2 is not None:
437
457
  e2 = _check_flat1darray(e2, 'e2', size=dim, dtype=float, norm=True)
438
458
 
459
+ # preliminary
460
+ allnone = all([ee is None for ee in [e0, e1, e2][:dim]])
461
+ if allnone is True:
462
+ lstr = [f"\t- {ee}" for ee in ['e0', 'e1', 'e2'][:dim]]
463
+ msg = (
464
+ f"For a basis f dimension {dim}, provide at least one of:\n"
465
+ + "\n".join(lstr)
466
+ )
467
+ raise Exception(msg)
468
+
469
+ # ----------------------
470
+ # dim = 2
471
+ # ----------------------
472
+
439
473
  # vectors
440
474
  if dim == 2:
441
475
 
442
- if e0 is None and e1 is None:
443
- msg = "Please provide e0 and/or e1!"
444
- raise Exception(msg)
445
-
446
476
  # complete if missing
447
477
  if e0 is None:
448
478
  e0 = np.r_[e1[1], -e1[0]]
@@ -455,16 +485,18 @@ def _check_vectbasis(
455
485
  raise Exception(msg)
456
486
 
457
487
  # direct
458
- if np.abs(np.cross(e0, e1).tolist() - 1.) < tol:
459
- msg = "Non-direct basis"
460
- raise Exception(msg)
488
+ if direct is True:
489
+ if np.abs(np.cross(e0, e1).tolist() - 1.) < tol:
490
+ msg = "Non-direct basis"
491
+ raise Exception(msg)
461
492
 
462
493
  return e0, e1
463
494
 
495
+ # ----------------------
496
+ # dim = 3
497
+ # ----------------------
498
+
464
499
  else:
465
- if e0 is None and e1 is None and e2 is None:
466
- msg = "Please provide at least e0, e1 or e2!"
467
- raise Exception(msg)
468
500
 
469
501
  # complete if 2 missing
470
502
  if e0 is None and e1 is None:
@@ -472,7 +504,7 @@ def _check_vectbasis(
472
504
  elif e0 is None and e2 is None:
473
505
  e2 = _get_vertical_unitvect(ee=e1)
474
506
  elif e1 is None and e2 is None:
475
- e2 = _get_vertical_unitvect(ee=e0)
507
+ e2 = _get_horizontal_unitvect(ee=e0)
476
508
 
477
509
  # complete if 1 missing
478
510
  if e0 is None:
@@ -502,9 +534,10 @@ def _check_vectbasis(
502
534
  raise Exception(msg)
503
535
 
504
536
  # direct
505
- if not np.allclose(np.cross(e0, e1), e2, atol=tol, rtol=1e-6):
506
- msg = "Non-direct basis"
507
- raise Exception(msg)
537
+ if direct is True:
538
+ if not np.allclose(np.cross(e0, e1), e2, atol=tol, rtol=1e-6):
539
+ msg = "Non-direct basis"
540
+ raise Exception(msg)
508
541
 
509
542
  return e0, e1, e2
510
543
 
datastock/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.0.50'
21
- __version_tuple__ = version_tuple = (0, 0, 50)
20
+ __version__ = version = '0.0.52'
21
+ __version_tuple__ = version_tuple = (0, 0, 52)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datastock
3
- Version: 0.0.50
3
+ Version: 0.0.52
4
4
  Summary: Generic handler for multiple heterogenous numpy arrays and subclasses
5
5
  Author-email: Didier VEZINET <didier.vezinet@gmail.com>
6
6
  Maintainer-email: Didier VEZINET <didier.vezinet@gmail.com>
@@ -24,7 +24,6 @@ License-File: LICENSE.txt
24
24
  Requires-Dist: numpy
25
25
  Requires-Dist: scipy
26
26
  Requires-Dist: matplotlib
27
- Requires-Dist: PyQt5; platform_system != "Windows"
28
27
  Requires-Dist: astropy
29
28
  Provides-Extra: linting
30
29
  Requires-Dist: ruff; extra == "linting"
@@ -17,7 +17,7 @@ datastock/_class3.py,sha256=CH1oD_lTfVlcDp29L_iwzSfP78vX6_edDmZG9aSb1Ks,10848
17
17
  datastock/_direct_calls.py,sha256=EHFwI2mGMDqGz8_Bv2BseMBX4J8dSdE_RcNX3pt0ZYY,1801
18
18
  datastock/_export_dataframe.py,sha256=fy-uJR3EhDlHvd9ls1EQna_C8fyha1jCJLu1DTKTkdo,1576
19
19
  datastock/_find_plateau.py,sha256=sqnAuy0361DXkqBb_Lo1MmIGjn35tnKFvcv6MW6hifs,2685
20
- datastock/_generic_check.py,sha256=4NmG7iPa02bxOC5K-6qw63UahQ2FNDbeKu_AGBpNMtc,26717
20
+ datastock/_generic_check.py,sha256=g_SNSCSvE-HMX1WWrNKgUaHe5j14k_d0Xv1QZNkmvTg,27491
21
21
  datastock/_generic_utils.py,sha256=_iV51SiujEmQfAlvyIEW4BvzIXdhPCD-vumV5DmUL44,23421
22
22
  datastock/_generic_utils_plot.py,sha256=xrWzeZFtdTAs-RO2DfpCRveJPqw_p4lRFtQuuAn1pD8,3709
23
23
  datastock/_plot_BvsA_as_distribution.py,sha256=fpRhlbv3Bk96buANC46Brc9hdLxkOAsoKpE5A9pohG0,15389
@@ -31,15 +31,15 @@ datastock/_plot_correlations.py,sha256=ITOypu_AEoKl0ihxocV-JVTXIHqut6p9TfG-xZmQy
31
31
  datastock/_plot_old_backup.py,sha256=XixTi2CiihKjtQP0TRycH0b25caWN1m35DgpsDeiWZE,21729
32
32
  datastock/_plot_text.py,sha256=wQPqjfpLyIioS2JeOt3E9C9HgYUJ49YEoOgRuKYvAR8,3143
33
33
  datastock/_saveload.py,sha256=1vAMp27KfqXbo5b_Pi8hJux0stsHq6dO5vy8k1d4_iA,14141
34
- datastock/_version.py,sha256=E35Bq14aHx0dG_mA8HPiJoVRTCMU_V3unyyjRET8Kww,513
34
+ datastock/_version.py,sha256=izwNZww8rRWqWXOrmNbMsAI1WrglfNORIf-8tNcGeG4,513
35
35
  datastock/version.py,sha256=VJcnSK0zygwEhh_p6KIoC9yiMkp0bs-SJgLCbyubs9o,91
36
36
  datastock/tests/__init__.py,sha256=teOo2xP0IO7PQMuMDmum61XVHe2TuxW3BiHiL73X8jQ,35
37
37
  datastock/tests/prepublish.py,sha256=3gSr3nRhEl5qsmhxJ-nEoePvbINYq0EvcZCfxfUVHBM,83
38
38
  datastock/tests/test_01_DataStock.py,sha256=aUseXH2zYnFtNDJSCuEROgPxfKKNeLCkCQSR--_Fheg,19176
39
39
  datastock/tests/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
- datastock-0.0.50.dist-info/licenses/LICENSE.txt,sha256=SM-QOA3JwR1e0RVBGb1HhPmc5yD1Gsl1CRPnMSKJhH8,1068
41
- datastock-0.0.50.dist-info/METADATA,sha256=FLc5tLiMeT7uqPs9_kNV3tZNALar_DErqHZeO0uql68,8893
42
- datastock-0.0.50.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
43
- datastock-0.0.50.dist-info/entry_points.txt,sha256=GqmxVVp9G2ulEDaS9gLpwSVOBLF_FEBlj8k5Z6TJKsc,42
44
- datastock-0.0.50.dist-info/top_level.txt,sha256=0HeA0gZ4G1IKtkPhmqijZRYH9hID6LKLQskeSjAna8g,10
45
- datastock-0.0.50.dist-info/RECORD,,
40
+ datastock-0.0.52.dist-info/licenses/LICENSE.txt,sha256=SM-QOA3JwR1e0RVBGb1HhPmc5yD1Gsl1CRPnMSKJhH8,1068
41
+ datastock-0.0.52.dist-info/METADATA,sha256=uv0ceVieQT6vaC1guDDYmcApD0jjrBeQcoqdPilwV4I,8842
42
+ datastock-0.0.52.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
43
+ datastock-0.0.52.dist-info/entry_points.txt,sha256=GqmxVVp9G2ulEDaS9gLpwSVOBLF_FEBlj8k5Z6TJKsc,42
44
+ datastock-0.0.52.dist-info/top_level.txt,sha256=0HeA0gZ4G1IKtkPhmqijZRYH9hID6LKLQskeSjAna8g,10
45
+ datastock-0.0.52.dist-info/RECORD,,