PyGamLab 0.2.3__py3-none-any.whl → 1.2.0__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.
Files changed (34) hide show
  1. PyGamLab/Constants.py +608 -1
  2. PyGamLab/{Convertors.py → Converters.py} +431 -32
  3. PyGamLab/Data_Analysis.py +5523 -2853
  4. PyGamLab/Functions.py +45 -97
  5. PyGamLab/__init__.py +2 -2
  6. PyGamLab/structures/GAM_architectures/GAM_Graphene.py +462 -0
  7. PyGamLab/structures/GAM_architectures/GAM_nano_particles.py +837 -0
  8. PyGamLab/structures/GAM_architectures/GAM_nanotubes.py +895 -0
  9. PyGamLab/structures/GAM_architectures/GAM_phosphorene.py +450 -0
  10. PyGamLab/structures/GAM_architectures/GAM_sillicene.py +434 -0
  11. PyGamLab/structures/GAM_architectures/__init__.py +16 -0
  12. PyGamLab/structures/Generators/__init__.py +16 -0
  13. PyGamLab/structures/Generators/auto_bulk.py +470 -0
  14. PyGamLab/structures/Generators/one_d.py +1262 -0
  15. PyGamLab/structures/Generators/two_d.py +1254 -0
  16. PyGamLab/structures/Generators/zero_d.py +606 -0
  17. PyGamLab/structures/Primatom/__init__.py +10 -0
  18. PyGamLab/structures/Primatom/gam_atom.py +756 -0
  19. PyGamLab/structures/Primatom/gam_bond.py +570 -0
  20. PyGamLab/structures/Primatom/gam_molecule.py +731 -0
  21. PyGamLab/structures/__init__.py +33 -0
  22. PyGamLab/structures/gamvis/__init__.py +9 -0
  23. PyGamLab/structures/gamvis/gamvis.py +865 -0
  24. PyGamLab/structures/gamvis/gamvis_engine.py +895 -0
  25. PyGamLab/structures/io/__init__.py +9 -0
  26. PyGamLab/structures/io/checker.py +226 -0
  27. PyGamLab/structures/io/conversions.py +510 -0
  28. PyGamLab/structures/io/export.py +440 -0
  29. PyGamLab/structures/io/read.py +718 -0
  30. {pygamlab-0.2.3.dist-info → pygamlab-1.2.0.dist-info}/METADATA +93 -21
  31. pygamlab-1.2.0.dist-info/RECORD +33 -0
  32. {pygamlab-0.2.3.dist-info → pygamlab-1.2.0.dist-info}/WHEEL +1 -1
  33. pygamlab-0.2.3.dist-info/RECORD +0 -9
  34. {pygamlab-0.2.3.dist-info → pygamlab-1.2.0.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,7 @@
1
-
2
1
  '''
3
- Convertors.py :
2
+ Converters.py :
4
3
 
5
4
  This module provides converter functions for transforming values between different units of measurement.
6
-
7
5
  '''
8
6
 
9
7
  #" IN GOD WE TRUST, ALL OTHERS MUST BRING DATA"
@@ -68,6 +66,13 @@ def Atmosphere_To_Pascal(atm):
68
66
  -------
69
67
  float
70
68
  The equivalent value in pascals.
69
+
70
+ Examples
71
+ --------
72
+ >>> Atmosphere_To_Pascal(1)
73
+ 101325.0
74
+ >>> Atmosphere_To_Pascal(0.5)
75
+ 50662.5
71
76
  """
72
77
  Pa = float(atm * 101325)
73
78
  return Pa
@@ -86,6 +91,13 @@ def Angstrom_To_Meter(A):
86
91
  -------
87
92
  float
88
93
  The equivalent value in meters.
94
+
95
+ Examples
96
+ --------
97
+ >>> Angstrom_To_Meter(1)
98
+ 1e-10
99
+ >>> Angstrom_To_Meter(5e3)
100
+ 5e-07
89
101
  """
90
102
  return A * 1e-10
91
103
 
@@ -103,6 +115,13 @@ def Angstrom_To_Millimeter(A):
103
115
  -------
104
116
  float
105
117
  The equivalent value in millimeters.
118
+
119
+ Examples
120
+ --------
121
+ >>> Angstrom_To_Millimeter(1e7)
122
+ 1.0
123
+ >>> Angstrom_To_Millimeter(5e6)
124
+ 0.5
106
125
  """
107
126
  return A * 1e-7
108
127
 
@@ -123,6 +142,13 @@ def Angstrom_To_Nanometer(Angstrom_value):
123
142
  Equivalent value in Nanometers (nm).
124
143
 
125
144
  '''
145
+
146
+ # Examples
147
+ # --------
148
+ # >>> Angstrom_To_Nanometer(10)
149
+ # 1.0
150
+ # >>> Angstrom_To_Nanometer(25)
151
+ # 2.5
126
152
  Nanometer_value= Angstrom_value/10
127
153
  return Nanometer_value
128
154
 
@@ -142,31 +168,47 @@ def Angstrom_To_Micrometer(A):
142
168
  -------
143
169
  float
144
170
  The equivalent value in micrometers.
171
+
172
+ Examples
173
+ --------
174
+ >>> Angstrom_To_Micrometer(10000)
175
+ 1.0
176
+ >>> Angstrom_To_Micrometer(25000)
177
+ 2.5
145
178
  """
146
179
  return A / 10000
147
180
 
148
181
 
149
- def Annual_To_Monthly_Loss(annual_loss):
150
- '''
151
-
182
+
183
+ def Binary_To_Decimal(Num_bin):
184
+ """
185
+ Converts a binary number (given as an int, e.g. 1011) to its decimal representation.
152
186
 
153
187
  Parameters
154
188
  ----------
155
- annual_loss : int
156
- the annual loss of an Economic enterprise.
189
+ Num_bin : int
190
+ The binary number to convert.
157
191
 
158
192
  Returns
159
193
  -------
160
-
161
- the monthly loss of an Economic enterprise.
162
-
163
- '''
164
- if not str(annual_loss).isdigit():
165
- print ('error! bad parameter!')
166
- return int(annual_loss/12)
167
-
168
-
169
-
194
+ int
195
+ The decimal representation of the binary number.
196
+
197
+ Examples
198
+ --------
199
+ >>> Binary_To_Decimal(1011)
200
+ 11
201
+ >>> Binary_To_Decimal(11111111)
202
+ 255
203
+ """
204
+ Dec = 0
205
+ i = 0
206
+ while Num_bin != 0:
207
+ r = Num_bin % 10
208
+ Dec = Dec + (r * (2**i))
209
+ Num_bin = Num_bin // 10
210
+ i = i + 1
211
+ return Dec
170
212
 
171
213
 
172
214
  def Byte_To_Kilobyte(b):
@@ -182,6 +224,13 @@ def Byte_To_Kilobyte(b):
182
224
  -------
183
225
  float
184
226
  The equivalent value in kilobytes.
227
+
228
+ Examples
229
+ --------
230
+ >>> Byte_To_Kilobyte(1024)
231
+ 1.0
232
+ >>> Byte_To_Kilobyte(512)
233
+ 0.5
185
234
  """
186
235
  kb = 0.0009765625 * b
187
236
  return kb
@@ -202,8 +251,13 @@ def Bar_To_Pascal(bar):
202
251
  Pa : float
203
252
  pascal
204
253
 
254
+ Example
255
+ -------
256
+ >>> Bar_To_Pascal(1)
257
+ 1e-05
205
258
  """
206
259
 
260
+
207
261
  Pa=bar*(10**(-5))
208
262
  return Pa
209
263
 
@@ -217,10 +271,18 @@ def Brinell_To_Rockwell(hb):
217
271
  hardness in Brinell scale.
218
272
 
219
273
  Returns float: Hardness in Rochwell scale.
274
+
275
+ Examples
276
+ --------
277
+ >>> Brinell_To_Rockwell(100)
278
+ 10.0
279
+ >>> Brinell_To_Rockwell(75)
280
+ 5.0
220
281
 
221
282
 
222
283
  '''
223
284
 
285
+
224
286
  hrb = (hb - 50) / 5.0
225
287
  return hrb
226
288
 
@@ -239,6 +301,7 @@ def Cubic_Meter_To_Liter(number_in_Cubic_Meter):
239
301
  Number per liter unit.
240
302
 
241
303
  '''
304
+
242
305
  Liter= number_in_Cubic_Meter*1000
243
306
  return Liter
244
307
 
@@ -261,12 +324,19 @@ def Celcius_To_Kelvin(Celcius):
261
324
  Notes
262
325
  -----
263
326
  The temperature in Celsius is offset by 273.15 to convert to Kelvin.
327
+
328
+ Examples
329
+ --------
330
+ >>> Celcius_To_Kelvin(0)
331
+ 273.15
332
+ >>> Celcius_To_Kelvin(25)
333
+ 298.15
264
334
  """
265
335
  Kelvin = Celcius + 273.15
266
336
  return Kelvin
267
337
 
268
338
 
269
- def Coulomb_To_Electron_volt(coulomb):
339
+ def Coulomb_To_Electron_Volt(coulomb):
270
340
  """
271
341
  Convert the given value in coulombs to electron volts.
272
342
 
@@ -283,6 +353,13 @@ def Coulomb_To_Electron_volt(coulomb):
283
353
  Notes
284
354
  -----
285
355
  1 coulomb = 6.24e18 electron volts.
356
+
357
+ Examples
358
+ --------
359
+ >>> Coulomb_To_Electron_Volt(1)
360
+ 6.24e+18
361
+ >>> Coulomb_To_Electron_Volt(1.6e-19)
362
+ 0.9984
286
363
  """
287
364
  electron_volt = coulomb * 6.24e18
288
365
  return electron_volt
@@ -301,10 +378,34 @@ def Centigrade_To_Fahrenheit(C):
301
378
  -------
302
379
  float
303
380
  The equivalent temperature in Fahrenheit.
381
+
382
+ Examples
383
+ --------
384
+ >>> Centigrade_To_Fahrenheit(0)
385
+ 32.0
386
+ >>> Centigrade_To_Fahrenheit(100)
387
+ 212.0
304
388
  """
305
389
  F = C * 1.8 + 32
306
390
  return F
307
391
 
392
+ def Centimeter_To_Inch(Centimeter):
393
+ '''
394
+ Parameters
395
+ ----------
396
+ Centimeter : float or int
397
+ One centimeter is equal to 0.393701 inches.
398
+ number per Centimeter unit.
399
+
400
+ Returns
401
+ -------
402
+ Inch : float
403
+ number per Inch unit.
404
+
405
+ '''
406
+
407
+ Inch = Centimeter / 2.54
408
+ return Inch
308
409
 
309
410
  def CmHg_To_Pascal(P1):
310
411
  """
@@ -319,6 +420,13 @@ def CmHg_To_Pascal(P1):
319
420
  -------
320
421
  float
321
422
  The equivalent pressure in pascals.
423
+
424
+ Examples
425
+ --------
426
+ >>> CmHg_To_Pascal(1)
427
+ 1333.22
428
+ >>> CmHg_To_Pascal(0.5)
429
+ 666.61
322
430
  """
323
431
  P2 = P1 * 1333.22
324
432
  return P2
@@ -339,6 +447,7 @@ def Calories_To_Joules(cal):
339
447
 
340
448
  """
341
449
 
450
+
342
451
  J=4.184*cal
343
452
  return J
344
453
 
@@ -358,11 +467,15 @@ def Centimeter_per_Minute_To_Meter_per_Hour_Welding_Speed_Converter(Centimeter_p
358
467
 
359
468
  '''
360
469
 
470
+
361
471
  Meter_per_Hour=Centimeter_per_Minute/1.7
472
+ #or
473
+ Meter_per_Hour = Centimeter_per_Minute * 0.6
474
+
362
475
  return Meter_per_Hour
363
476
 
364
477
 
365
- def Current_density_To_mpy(Current_density,density,masschange,valency):
478
+ def Current_Density_To_Mpy(Current_density,density,masschange,valency):
366
479
  """
367
480
 
368
481
 
@@ -383,6 +496,7 @@ def Current_density_To_mpy(Current_density,density,masschange,valency):
383
496
 
384
497
 
385
498
  """
499
+
386
500
  corrosion_rate_mpy=Current_density*1e-6*31536000*(1/density)*masschange*400*(1/(valency*96500))
387
501
  return corrosion_rate_mpy
388
502
 
@@ -401,6 +515,7 @@ def CC_per_Second_To_Liter_per_Minute_Welding_Gas_Flow_Rate_Converter(CC_per_Sec
401
515
 
402
516
  '''
403
517
 
518
+
404
519
  Liter_per_Minute=CC_per_Second/16.67
405
520
  return Liter_per_Minute
406
521
 
@@ -419,6 +534,13 @@ def Degree_To_Radian(deg):
419
534
  -------
420
535
  float
421
536
  The angle value in radians.
537
+
538
+ Examples
539
+ --------
540
+ >>> Degree_To_Radian(180)
541
+ 3.141592653589793
542
+ >>> Degree_To_Radian(90)
543
+ 1.5707963267948966
422
544
  """
423
545
  rad = deg * 3.141592653589793 / 180
424
546
  return rad
@@ -437,6 +559,13 @@ def Decimal_To_Binary(Num_dec):
437
559
  -------
438
560
  int
439
561
  The binary representation of the decimal number.
562
+
563
+ Examples
564
+ --------
565
+ >>> Decimal_To_Binary(11)
566
+ 1011
567
+ >>> Decimal_To_Binary(255)
568
+ 11111111
440
569
  """
441
570
  Bin = 0
442
571
  i = 0
@@ -461,6 +590,13 @@ def Electronvolt_To_Joule(e_v):
461
590
  -------
462
591
  float
463
592
  The energy value in joules.
593
+
594
+ Examples
595
+ --------
596
+ >>> Electronvolt_To_Joule(1)
597
+ 1.6022e-19
598
+ >>> Electronvolt_To_Joule(6.241509074e18)
599
+ 1.0000000001902376
464
600
  """
465
601
  Joule = e_v * 1.6022e-19
466
602
  return Joule
@@ -480,6 +616,13 @@ def Electron_volt_To_Coulomb(electron_volt):
480
616
  -------
481
617
  float
482
618
  The equivalent charge value in coulombs.
619
+
620
+ Examples
621
+ --------
622
+ >>> Electron_volt_To_Coulomb(1)
623
+ 1.602e-19
624
+ >>> Electron_volt_To_Coulomb(6.241e18)
625
+ 0.99999842
483
626
  """
484
627
  coulomb = electron_volt * 1.602e-19
485
628
  return coulomb
@@ -498,6 +641,13 @@ def Foot_To_Mile(ft):
498
641
  -------
499
642
  float
500
643
  The length value in miles.
644
+
645
+ Examples
646
+ --------
647
+ >>> Foot_To_Mile(5280)
648
+ 1.00000000032
649
+ >>> Foot_To_Mile(2640)
650
+ 0.50000000016
501
651
  """
502
652
  mi = 0.000189393939 * ft
503
653
  return mi
@@ -516,6 +666,13 @@ def Fahrenheit_To_Centigrade(F):
516
666
  -------
517
667
  float
518
668
  The temperature value in Centigrade (Celsius).
669
+
670
+ Examples
671
+ --------
672
+ >>> Fahrenheit_To_Centigrade(32)
673
+ 0.0
674
+ >>> Fahrenheit_To_Centigrade(212)
675
+ 100.0
519
676
  """
520
677
  C = (F - 32) * 5/9
521
678
  return C
@@ -545,7 +702,7 @@ def Foot_Pound_To_Newton(Foot_Pounds):
545
702
  return Newton_Meters
546
703
 
547
704
 
548
- def Fabric_GSM_to_GLM(Fabric_Weight,Fabric_Width):
705
+ def Fabric_GSM_To_GLM(Fabric_Weight,Fabric_Width):
549
706
  '''
550
707
  This function converts fabric weight in GSM unit to GLM unit.
551
708
 
@@ -559,10 +716,30 @@ def Fabric_GSM_to_GLM(Fabric_Weight,Fabric_Width):
559
716
  Result.
560
717
 
561
718
  '''
719
+
562
720
  Fabric_GLM=(Fabric_Weight*Fabric_Width)/39.37
563
721
  return Fabric_GLM
564
722
 
565
723
 
724
+ def Fabric_GLM_To_GSM(Fabric_GLM, Fabric_Width):
725
+ '''
726
+ This function converts fabric weight in GLM unit to GSM unit.
727
+
728
+ Parameters
729
+ ----------
730
+ Fabric_GLM : int or float
731
+ Fabric weight per GLM.
732
+ Fabric_Width : int or float
733
+ Width of fabric in inches.
734
+
735
+ Returns
736
+ -------
737
+ Fabric_GSM : float
738
+ Fabric weight in GSM.
739
+ '''
740
+
741
+ Fabric_GSM = (Fabric_GLM * 39.37) / Fabric_Width
742
+ return Fabric_GSM
566
743
 
567
744
 
568
745
  def Force_CGS_To_SI (Force_in_CGS):
@@ -581,6 +758,7 @@ def Force_CGS_To_SI (Force_in_CGS):
581
758
 
582
759
  '''
583
760
 
761
+
584
762
  SI = "{:e}".format(Force_in_CGS * 1e-5)
585
763
  return SI
586
764
 
@@ -600,6 +778,7 @@ def Force_SI_To_CGS (Force_in_SI) :
600
778
 
601
779
  '''
602
780
 
781
+
603
782
  CGS = "{:e}".format(Force_in_SI * 1e+5)
604
783
  return CGS
605
784
 
@@ -624,6 +803,7 @@ def Gram_To_Mole(g,MW):
624
803
  Mole is the eqivalent amount of substance of a compound in mole(s).
625
804
 
626
805
  '''
806
+
627
807
  Mole = g / MW
628
808
  return Mole
629
809
 
@@ -642,6 +822,13 @@ def Hour_To_Sec(t):
642
822
  -------
643
823
  float
644
824
  The time value in seconds.
825
+
826
+ Examples
827
+ --------
828
+ >>> Hour_To_Sec(1)
829
+ 3600
830
+ >>> Hour_To_Sec(2.5)
831
+ 9000.0
645
832
  """
646
833
  t = t * 3600
647
834
  return t
@@ -657,6 +844,13 @@ def Hertz_To_Rpm(a,/):
657
844
  Returns
658
845
  b : int or float
659
846
  frequency, revolution per minute (rpm)
847
+
848
+ Examples
849
+ --------
850
+ >>> Hertz_To_Rpm(1)
851
+ 60
852
+ >>> Hertz_To_Rpm(2.5)
853
+ 150.0
660
854
  '''
661
855
  b=a*60
662
856
  return b
@@ -676,6 +870,12 @@ def Horsepower_To_Watt (Horsepower):
676
870
  watt : float
677
871
  return your number in watt.
678
872
 
873
+ Examples
874
+ --------
875
+ >>> Horsepower_To_Watt(1)
876
+ '7.457000e+02'
877
+ >>> Horsepower_To_Watt(2)
878
+ '1.491400e+03'
679
879
  '''
680
880
  Watt = "{:e}".format(Horsepower * 745.7)
681
881
  return Watt
@@ -737,6 +937,24 @@ def Joules_To_Calories(J):
737
937
  cal=J/4.184
738
938
  return cal
739
939
 
940
+ def Joule_To_Electronvolt(Joule):
941
+ """
942
+ Converts energy value from joules to electronvolts.
943
+
944
+ Parameters
945
+ ----------
946
+ Joule : float
947
+ The energy value in joules.
948
+
949
+ Returns
950
+ -------
951
+ float
952
+ The energy value in electronvolts.
953
+ """
954
+ e_v = Joule / 1.6022e-19
955
+ return e_v
956
+
957
+
740
958
  def Joules_Per_Minute_To_Kilowatt(Joules_Per_Minute):
741
959
  '''
742
960
 
@@ -775,8 +993,26 @@ def Kilogram_To_Pound(number_in_kilogram):
775
993
  pound=number_in_kilogram*2.2046
776
994
  return pound
777
995
 
996
+ def Kilowatt_To_Joules_Per_Minute(Kilowatt):
997
+ '''
998
+ Converts power from kilowatts to joules per minute.
778
999
 
779
- def Kelvin_to_Celcius(Kelvin):
1000
+ Parameters
1001
+ ----------
1002
+ Kilowatt : float
1003
+ The power value in kilowatts.
1004
+
1005
+ Returns
1006
+ -------
1007
+ Joules_Per_Minute : float
1008
+ The equivalent power in joules per minute.
1009
+ '''
1010
+ Joules_Per_Minute = Kilowatt * 60000
1011
+ return Joules_Per_Minute
1012
+
1013
+
1014
+
1015
+ def Kelvin_To_Celcius(Kelvin):
780
1016
  """
781
1017
  This function is used to convert Kelvin to Celsius.
782
1018
  The temperature in Celsius is different from the temperature in Kelvin by 273.15.
@@ -790,6 +1026,13 @@ def Kelvin_to_Celcius(Kelvin):
790
1026
  -------
791
1027
  float
792
1028
  The temperature value in Celsius.
1029
+
1030
+ Examples
1031
+ --------
1032
+ >>> Kelvin_To_Celcius(273.15)
1033
+ 0.0
1034
+ >>> Kelvin_To_Celcius(298.15)
1035
+ 25.0
793
1036
  """
794
1037
  Celcius = Kelvin - 273.15
795
1038
  return Celcius
@@ -825,6 +1068,13 @@ def KiloMeter_To_LightYear(km):
825
1068
  -------
826
1069
  float
827
1070
  The distance value in light-years.
1071
+
1072
+ Examples
1073
+ --------
1074
+ >>> KiloMeter_To_LightYear(9460730472801.1)
1075
+ 1.0
1076
+ >>> round(KiloMeter_To_LightYear(4730365236400.55), 1)
1077
+ 0.5
828
1078
  """
829
1079
  ly = km / 9460730472801.1
830
1080
  return ly
@@ -862,6 +1112,13 @@ def Kilobyte_To_Byte(kb):
862
1112
  -------
863
1113
  float
864
1114
  The data size value in bytes.
1115
+
1116
+ Examples
1117
+ --------
1118
+ >>> Kilobyte_To_Byte(1)
1119
+ 1024
1120
+ >>> Kilobyte_To_Byte(0.5)
1121
+ 512.0
865
1122
  """
866
1123
  b = 1024 * kb
867
1124
  return b
@@ -881,6 +1138,13 @@ def Kilometer_Per_Hour_To_Meter_Per_Second(kph):
881
1138
  -------
882
1139
  float
883
1140
  The speed value in meters per second.
1141
+
1142
+ Examples
1143
+ --------
1144
+ >>> Kilometer_Per_Hour_To_Meter_Per_Second(3.6)
1145
+ 1.0
1146
+ >>> Kilometer_Per_Hour_To_Meter_Per_Second(36)
1147
+ 10.0
884
1148
  """
885
1149
  mps = kph / 3.6
886
1150
  return mps
@@ -899,6 +1163,13 @@ def Kg_To_Ton(Kg):
899
1163
  -------
900
1164
  float
901
1165
  The mass value in metric tons.
1166
+
1167
+ Examples
1168
+ --------
1169
+ >>> Kg_To_Ton(1000)
1170
+ 1.0
1171
+ >>> Kg_To_Ton(250)
1172
+ 0.25
902
1173
  """
903
1174
  Ton = Kg / 1000
904
1175
  return Ton
@@ -917,6 +1188,13 @@ def Kg_To_Lbm(Kg):
917
1188
  -------
918
1189
  float
919
1190
  The mass value in pounds (lbm).
1191
+
1192
+ Examples
1193
+ --------
1194
+ >>> Kg_To_Lbm(1)
1195
+ 2.20462
1196
+ >>> Kg_To_Lbm(5)
1197
+ 11.0231
920
1198
  """
921
1199
  Lbm = Kg * 2.20462
922
1200
  return Lbm
@@ -936,6 +1214,7 @@ def Liter_To_Cubic_Meter(number_in_Liter):
936
1214
  Number per cubic meter unit.
937
1215
 
938
1216
  '''
1217
+
939
1218
  Cubic_Meter= number_in_Liter/1000
940
1219
  return (Cubic_Meter)
941
1220
 
@@ -954,6 +1233,13 @@ def LightYear_To_KiloMeter(ly):
954
1233
  -------
955
1234
  float
956
1235
  The distance value in kilometers.
1236
+
1237
+ Examples
1238
+ --------
1239
+ >>> LightYear_To_KiloMeter(1)
1240
+ 9460730472801.1
1241
+ >>> LightYear_To_KiloMeter(0.5)
1242
+ 4730365236400.55
957
1243
  """
958
1244
  km = ly * 9460730472801.1
959
1245
  return km
@@ -972,13 +1258,20 @@ def Lbm_To_Kg(Lbm):
972
1258
  -------
973
1259
  float
974
1260
  The mass value in kilograms.
1261
+
1262
+ Examples
1263
+ --------
1264
+ >>> Lbm_To_Kg(2.20462)
1265
+ 0.9999996694214878
1266
+ >>> Lbm_To_Kg(1)
1267
+ 0.4535924254969406
975
1268
  """
976
1269
  Kg = Lbm / 2.20462
977
1270
  return Kg
978
1271
 
979
1272
 
980
1273
 
981
- def Liter_per_Minute_To_CC_per_Second_Welding_Gas_Flow_Rate_Converter(Liter_per_Minute):
1274
+ def Liter_Per_Minute_To_CC_Per_Second_Welding_Gas_Flow_Rate_Converter(Liter_per_Minute):
982
1275
  '''
983
1276
  This function converts the Welding Gas Flow Rate from Liter per Minute to CC per Second.
984
1277
 
@@ -993,6 +1286,7 @@ def Liter_per_Minute_To_CC_per_Second_Welding_Gas_Flow_Rate_Converter(Liter_per_
993
1286
 
994
1287
  '''
995
1288
 
1289
+
996
1290
  CC_per_Second=Liter_per_Minute*16.67
997
1291
  return CC_per_Second
998
1292
 
@@ -1366,7 +1660,7 @@ def Mpa_To_Psi(Num_Mpa,/):
1366
1660
  return Psi
1367
1661
 
1368
1662
 
1369
- def Meter_per_Hour_To_Centimeter_per_Minute_Welding_Speed_Converter(Meter_per_Hour):
1663
+ def Meter_Per_Hour_To_Centimeter_Per_Minute_Welding_Speed_Converter(Meter_per_Hour):
1370
1664
  '''
1371
1665
  This function converts the Welding Speed from Meter per Hour to Centimeter per Minute.
1372
1666
 
@@ -1386,7 +1680,7 @@ def Meter_per_Hour_To_Centimeter_per_Minute_Welding_Speed_Converter(Meter_per_Ho
1386
1680
 
1387
1681
 
1388
1682
 
1389
- def Mm_year_To_Mils_year(milpy):
1683
+ def Mm_Year_To_Mils_Year(milpy):
1390
1684
  """
1391
1685
  Converts a corrosion rate from millimeters per year (mm/yr) to mils per year (mpy).
1392
1686
  1 mm/yr = 39.37 mpy
@@ -1405,7 +1699,7 @@ def Mm_year_To_Mils_year(milpy):
1405
1699
  return mpy
1406
1700
 
1407
1701
 
1408
- def Mils_year_To_Mm_year(mpy):
1702
+ def Mils_Year_To_Mm_Year(mpy):
1409
1703
  """
1410
1704
  Converts a corrosion rate from mils per year (mpy) to millimeters per year (mm/yr).
1411
1705
  1 mm/yr = 39.37 mpy
@@ -1425,7 +1719,7 @@ def Mils_year_To_Mm_year(mpy):
1425
1719
 
1426
1720
 
1427
1721
 
1428
- def Mpy_To_current_density(mpy,density,masschange,valency):
1722
+ def Mpy_To_Current_Density(mpy,density,masschange,valency):
1429
1723
  """
1430
1724
 
1431
1725
 
@@ -1493,7 +1787,7 @@ def Nanometer_To_Micrometer(nanometer):
1493
1787
  return Micrometer
1494
1788
 
1495
1789
 
1496
- def Newton_TO_Pound_Force(Newton):
1790
+ def Newton_To_Pound_Force(Newton):
1497
1791
  # 1 Pound_Force = 4.448221619 New
1498
1792
 
1499
1793
 
@@ -1552,6 +1846,8 @@ def Nanometer_To_Angstrom(Nanometer_value):
1552
1846
  Angstrom_value= Nanometer_value*10
1553
1847
  return Angstrom_value
1554
1848
 
1849
+
1850
+
1555
1851
  def Newton_To_Foot_Pound(Newton_Meters):
1556
1852
  '''
1557
1853
  # This Conventor convert Nm to ft-lbs
@@ -1573,7 +1869,6 @@ def Newton_To_Foot_Pound(Newton_Meters):
1573
1869
 
1574
1870
 
1575
1871
 
1576
-
1577
1872
  def Pounds_Per_Cubic_Inch_To_Kilogeram_Per_Cubic_Meter(LbPerCubicInch):
1578
1873
  """
1579
1874
  Converts a density value from pounds per cubic inch to kilograms per cubic meter.
@@ -1679,7 +1974,7 @@ def Percentages_To_Moles(total, percentages):
1679
1974
 
1680
1975
 
1681
1976
 
1682
- def Pascal_to_mmHg(p):
1977
+ def Pascal_To_MmHg(p):
1683
1978
  '''
1684
1979
  This function convert pascal to mmHg
1685
1980
 
@@ -1842,7 +2137,22 @@ def Pound_To_Kilogram(number_in_pound):
1842
2137
  return kilogram
1843
2138
 
1844
2139
 
2140
+ def Ppm_To_Weightpercent(ppm):
2141
+ """
2142
+ This function is used to convert ppm (parts per million) to weight percent.
2143
+
2144
+ Parameters
2145
+ ----------
2146
+ ppm : float
2147
+ The concentration in ppm.
1845
2148
 
2149
+ Returns
2150
+ -------
2151
+ float
2152
+ The concentration in weight percent.
2153
+ """
2154
+ weight_percent = ppm / 10000
2155
+ return weight_percent
1846
2156
 
1847
2157
 
1848
2158
 
@@ -1867,7 +2177,60 @@ def Molarity_To_Normality(Molarity,n):
1867
2177
 
1868
2178
 
1869
2179
 
2180
+ def MmHg_To_Pascal(mmHg):
2181
+ """
2182
+ Convert pressure from millimeters of mercury (mmHg) to Pascal (Pa).
2183
+
2184
+ Parameters
2185
+ ----------
2186
+ mmHg : float
2187
+ Pressure in millimeters of mercury.
2188
+
2189
+ Returns
2190
+ -------
2191
+ float
2192
+ Pressure in Pascals.
2193
+ """
2194
+ Pa = mmHg * 133.322
2195
+ return Pa
2196
+
2197
+ def Moles_To_Percentages(moles):
2198
+ """
2199
+ Calculate weight percentages of each component from their moles.
2200
+
2201
+ Parameters
2202
+ ----------
2203
+ moles : dict
2204
+ Dictionary where keys are material names and values are the number of moles.
1870
2205
 
2206
+ Returns
2207
+ -------
2208
+ dict
2209
+ Dictionary where keys are material names and values are weight percentages.
2210
+ """
2211
+ molar_weight = {
2212
+ 'TEGDMA': 156.27,
2213
+ 'BIS_GMA': 512.67,
2214
+ 'UDMA': 398.48,
2215
+ 'Silica dioxide': 60.08,
2216
+ 'Barium silicate': 233.39,
2217
+ 'Zirconium dioxide': 123.22
2218
+ }
2219
+
2220
+ # Calculate mass of each component
2221
+ mass = {}
2222
+ for material, n_moles in moles.items():
2223
+ if material not in molar_weight:
2224
+ raise ValueError(f"Molar weight for '{material}' not defined.")
2225
+ mass[material] = n_moles * molar_weight[material]
2226
+
2227
+ # Total mass
2228
+ total_mass = sum(mass.values())
2229
+
2230
+ # Convert to weight percentages
2231
+ percentages = {material: (m / total_mass) * 100 for material, m in mass.items()}
2232
+
2233
+ return percentages
1871
2234
 
1872
2235
  def Square_Meter_To_Square_Cm(b):
1873
2236
 
@@ -1934,7 +2297,7 @@ def Sec_To_Hour(t):
1934
2297
  return t
1935
2298
 
1936
2299
 
1937
- def Radians_To_Degrees(num):
2300
+ def Radian_To_Degrees(num):
1938
2301
  """
1939
2302
  This function is used to convert radians to degrees.
1940
2303
 
@@ -1951,6 +2314,25 @@ def Radians_To_Degrees(num):
1951
2314
  degree = num * 180 / math.pi
1952
2315
  return degree
1953
2316
 
2317
+
2318
+ def Rockwell_To_Brinell(hrb):
2319
+ '''
2320
+ Convert Rockwell hardness (HRB) to Brinell hardness (HB).
2321
+
2322
+ Parameters
2323
+ ----------
2324
+ hrb : float
2325
+ Hardness in Rockwell B scale.
2326
+
2327
+ Returns
2328
+ -------
2329
+ float
2330
+ Hardness in Brinell scale.
2331
+ '''
2332
+ hb = (hrb * 5.0) + 50
2333
+ return hb
2334
+
2335
+
1954
2336
  def Rpm_To_Hertz(b,/):
1955
2337
  '''
1956
2338
  A converter machine to convert frequency in rpm to frequency in Herta(Hz).
@@ -1985,6 +2367,23 @@ def Torr_To_Pascal(torr):
1985
2367
  pa = torr * 133.322
1986
2368
  return pa
1987
2369
 
2370
+ def Ton_To_Kg(Ton):
2371
+ """
2372
+ Converts a mass value from metric tons to kilograms.
2373
+
2374
+ Parameters
2375
+ ----------
2376
+ Ton : float
2377
+ The mass value in metric tons.
2378
+
2379
+ Returns
2380
+ -------
2381
+ float
2382
+ The mass value in kilograms.
2383
+ """
2384
+ Kg = Ton * 1000
2385
+ return Kg
2386
+
1988
2387
 
1989
2388
  def Viscosity_To_Poise(pa_s):
1990
2389
  """
@@ -2028,7 +2427,7 @@ def Viscosity_To_Pas(poise):
2028
2427
 
2029
2428
 
2030
2429
 
2031
- def Yarn_Count_Converter(Yarn_Count, Current_System='tex', Desired_System='den'):
2430
+ def Yarn_Count_To_Other_System(Yarn_Count, Current_System='tex', Desired_System='den'):
2032
2431
  '''
2033
2432
  This function converts yarn count values in different systems.
2034
2433