radboy 0.0.714__py3-none-any.whl → 0.0.716__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.

Potentially problematic release.


This version of radboy might be problematic. Click here for more details.

@@ -1,362 +1,5 @@
1
1
  from . import *
2
2
 
3
- def volume():
4
- height=Prompt.__init2__(None,func=FormBuilderMkText,ptext="height?: ",helpText="height=1",data="dec.dec")
5
- if height is None:
6
- return
7
- elif height in ['d',]:
8
- height=Decimal('1')
9
-
10
- width=Prompt.__init2__(None,func=FormBuilderMkText,ptext="width?: ",helpText="width=1 ",data="dec.dec")
11
- if width is None:
12
- return
13
- elif width in ['d',]:
14
- width=Decimal('1')
15
-
16
-
17
-
18
- length=Prompt.__init2__(None,func=FormBuilderMkText,ptext="length?: ",helpText="length=1",data="dec.dec")
19
- if length is None:
20
- return
21
- elif length in ['d',]:
22
- length=Decimal('1')
23
-
24
- return length*width*height
25
-
26
- def volume_pint():
27
- height=Prompt.__init2__(None,func=FormBuilderMkText,ptext="height?: ",helpText="height=1",data="string")
28
- if height is None:
29
- return
30
- elif height in ['d',]:
31
- height='1'
32
-
33
- width=Prompt.__init2__(None,func=FormBuilderMkText,ptext="width?: ",helpText="width=1 ",data="string")
34
- if width is None:
35
- return
36
- elif width in ['d',]:
37
- width='1'
38
-
39
-
40
-
41
- length=Prompt.__init2__(None,func=FormBuilderMkText,ptext="length?: ",helpText="length=1",data="string")
42
- if length is None:
43
- return
44
- elif length in ['d',]:
45
- length='1'
46
-
47
- return unit_registry.Quantity(length)*unit_registry.Quantity(width)*unit_registry.Quantity(height)
48
-
49
- def inductance_pint():
50
- relative_permeability=Prompt.__init2__(None,func=FormBuilderMkText,ptext="relative_permeability?: ",helpText="relative_permeability(air)=1",data="string")
51
- if relative_permeability is None:
52
- return
53
- elif relative_permeability in ['d',]:
54
- relative_permeability='1'
55
- relative_permeability=float(relative_permeability)
56
-
57
- turns_of_wire_on_coil=Prompt.__init2__(None,func=FormBuilderMkText,ptext="turns_of_wire_on_coil?: ",helpText="turns_of_wire_on_coil=1",data="string")
58
- if turns_of_wire_on_coil is None:
59
- return
60
- elif turns_of_wire_on_coil in ['d',]:
61
- turns_of_wire_on_coil='1'
62
- turns_of_wire_on_coil=int(turns_of_wire_on_coil)
63
-
64
- #convert to meters
65
- core_cross_sectional_area_meters=Prompt.__init2__(None,func=FormBuilderMkText,ptext="core_cross_sectional_area_meters?: ",helpText="core_cross_sectional_area_meters=1",data="string")
66
- if core_cross_sectional_area_meters is None:
67
- return
68
- elif core_cross_sectional_area_meters in ['d',]:
69
- core_cross_sectional_area_meters='1m'
70
- try:
71
- core_cross_sectional_area_meters=unit_registry.Quantity(core_cross_sectional_area_meters).to("meters")
72
- except Exception as e:
73
- print(e,"defaulting to meters")
74
- core_cross_sectional_area_meters=unit_registry.Quantity(f"{core_cross_sectional_area_meters} meters")
75
-
76
- length_of_coil_meters=Prompt.__init2__(None,func=FormBuilderMkText,ptext="length_of_coil_meters?: ",helpText="length_of_coil_meters=1",data="string")
77
- if length_of_coil_meters is None:
78
- return
79
- elif length_of_coil_meters in ['d',]:
80
- length_of_coil_meters='1m'
81
- try:
82
- length_of_coil_meters=unit_registry.Quantity(length_of_coil_meters).to('meters')
83
- except Exception as e:
84
- print(e,"defaulting to meters")
85
- length_of_coil_meters=unit_registry.Quantity(f"{length_of_coil_meters} meters")
86
-
87
- numerator=((turns_of_wire_on_coil**2)*core_cross_sectional_area_meters)
88
- f=relative_permeability*(numerator/length_of_coil_meters)*1.26e-6
89
- f=unit_registry.Quantity(f"{f.magnitude} H")
90
- return f
91
-
92
- def resonant_inductance():
93
- hertz=1e9
94
- while True:
95
- try:
96
- hertz=Control(func=FormBuilderMkText,ptext="frequency in hertz[530 kilohertz]? ",helpText="frequency in hertz",data="string")
97
- if hertz is None:
98
- return
99
- elif hertz in ['d','']:
100
- hertz="530 megahertz"
101
- print(hertz)
102
- x=unit_registry.Quantity(hertz)
103
- if x:
104
- hertz=x.to("hertz")
105
- else:
106
- hertz=1e6
107
- break
108
- except Exception as e:
109
- print(e)
110
-
111
-
112
- while True:
113
- try:
114
- capacitance=Control(func=FormBuilderMkText,ptext="capacitance[365 picofarads]? ",helpText="capacitance in farads",data="string")
115
- if capacitance is None:
116
- return
117
- elif capacitance in ['d',]:
118
- capacitance="365 picofarads"
119
- x=unit_registry.Quantity(capacitance)
120
- if x:
121
- x=x.to("farads")
122
- farads=x.magnitude
123
- break
124
- except Exception as e:
125
- print(e)
126
-
127
- inductance=1/(decc(4*math.pi**2)*decc(hertz.magnitude**2,cf=13)*decc(farads,cf=13))
128
-
129
- L=unit_registry.Quantity(inductance,"henry")
130
- return L
131
-
132
- def air_coil_cap():
133
- '''C = 1 / (4π²f²L)'''
134
- while True:
135
- try:
136
- frequency=Control(func=FormBuilderMkText,ptext="frequency? ",helpText="frequency",data="string")
137
- if frequency is None:
138
- return
139
- elif frequency in ['d',]:
140
- frequency="1410 kilohertz"
141
- x=unit_registry.Quantity(frequency)
142
- if x:
143
- x=x.to("hertz")
144
- frequency=decc(x.magnitude**2)
145
- break
146
- except Exception as e:
147
- print(e)
148
-
149
- while True:
150
- try:
151
- inductance=Control(func=FormBuilderMkText,ptext="inductance(356 microhenry): ",helpText="coil inductance",data="string")
152
- if inductance is None:
153
- return
154
- elif inductance in ['d',]:
155
- inductance="356 microhenry"
156
- x=unit_registry.Quantity(inductance)
157
- if x:
158
- x=x.to("henry")
159
- inductance=decc(x.magnitude,cf=20)
160
- break
161
- except Exception as e:
162
- print(e)
163
-
164
-
165
-
166
- farads=1/(inductance*frequency*decc(4*math.pi**2))
167
- return unit_registry.Quantity(farads,"farad")
168
-
169
- def air_coil():
170
- '''
171
- The formula for inductance - using toilet rolls, PVC pipe etc. can be well approximated by:
172
-
173
-
174
- 0.394 * r2 * N2
175
- Inductance L = ________________
176
- ( 9 *r ) + ( 10 * Len)
177
- Here:
178
- N = number of turns
179
- r = radius of the coil i.e. form diameter (in cm.) divided by 2
180
- Len = length of the coil - again in cm.
181
- L = inductance in uH.
182
- * = multiply by
183
- '''
184
- while True:
185
- try:
186
- diameter=Control(func=FormBuilderMkText,ptext="diameter in cm [2 cm]? ",helpText="diamater of coil",data="string")
187
- if diameter is None:
188
- return
189
- elif diameter in ['d',]:
190
- diameter="2 cm"
191
- x=unit_registry.Quantity(diameter)
192
- if x:
193
- x=x.to("centimeter")
194
- diameter=x.magnitude
195
- break
196
- except Exception as e:
197
- print(e)
198
- radius=decc(diameter/2)
199
- while True:
200
- try:
201
- length=Control(func=FormBuilderMkText,ptext="length in cm [2 cm]? ",helpText="length of coil",data="string")
202
- if length is None:
203
- return
204
- elif length in ['d',]:
205
- length="2 cm"
206
- x=unit_registry.Quantity(length)
207
- if x:
208
- x=x.to("centimeter")
209
- length=x.magnitude
210
- break
211
- except Exception as e:
212
- print(e)
213
- while True:
214
- try:
215
- turns=Control(func=FormBuilderMkText,ptext="number of turns? ",helpText="turns of wire",data="integer")
216
- if turns is None:
217
- return
218
- elif turns in ['d',]:
219
- turns=1
220
- LTop=decc(0.394)*decc(radius**2)*decc(turns**2)
221
- LBottom=(decc(9)*radius)+decc(length*10)
222
- L=LTop/LBottom
223
- print(pint.Quantity(L,'microhenry'))
224
- different_turns=Control(func=FormBuilderMkText,ptext="use a different number of turns?",helpText="yes or no",data="boolean")
225
- if different_turns is None:
226
- return
227
- elif different_turns in ['d',True]:
228
- continue
229
- break
230
- except Exception as e:
231
- print(e)
232
-
233
-
234
- return pint.Quantity(L,'microhenry')
235
-
236
- def circumference_diameter():
237
- radius=0
238
- while True:
239
- try:
240
- diameter=Control(func=FormBuilderMkText,ptext="diameter unit[4 cm]? ",helpText="diamater with unit",data="string")
241
- if diameter is None:
242
- return
243
- elif diameter in ['d',]:
244
- diameter="4 cm"
245
- x=unit_registry.Quantity(diameter)
246
- radius=pint.Quantity(decc(x.magnitude/2),x.units)
247
- break
248
- except Exception as e:
249
- print(e)
250
- if isinstance(radius,pint.registry.Quantity):
251
- result=decc(2*math.pi)*decc(radius.magnitude)
252
-
253
- return pint.Quantity(result,radius.units)
254
- else:
255
- return
256
-
257
- def circumference_radius():
258
- radius=0
259
- while True:
260
- try:
261
- diameter=Control(func=FormBuilderMkText,ptext="radius unit[2 cm]? ",helpText="radius with unit",data="string")
262
- if diameter is None:
263
- return
264
- elif diameter in ['d',]:
265
- diameter="2 cm"
266
- x=unit_registry.Quantity(diameter)
267
- radius=pint.Quantity(decc(x.magnitude),x.units)
268
- break
269
- except Exception as e:
270
- print(e)
271
- if isinstance(radius,pint.registry.Quantity):
272
- result=decc(2*math.pi)*decc(radius.magnitude)
273
-
274
- return pint.Quantity(result,radius.units)
275
- else:
276
- return
277
-
278
- def area_of_circle_radius():
279
- '''
280
- A = πr²
281
- '''
282
- radius=0
283
- while True:
284
- try:
285
- diameter=Control(func=FormBuilderMkText,ptext="radius unit[2 cm]? ",helpText="radius with unit",data="string")
286
- if diameter is None:
287
- return
288
- elif diameter in ['d',]:
289
- diameter="2 cm"
290
- x=unit_registry.Quantity(diameter)
291
- radius=pint.Quantity(decc(x.magnitude),x.units)
292
- break
293
- except Exception as e:
294
- print(e)
295
- if isinstance(radius,pint.registry.Quantity):
296
- result=decc(math.pi)*decc(radius.magnitude**2)
297
-
298
- return pint.Quantity(result,radius.units)
299
- else:
300
- return
301
-
302
- def lc_frequency():
303
- inductance=None
304
- capacitance=None
305
- while True:
306
- try:
307
- inductance=Control(func=FormBuilderMkText,ptext="inductance(356 microhenry): ",helpText="coil inductance",data="string")
308
- if inductance is None:
309
- return
310
- elif inductance in ['d',]:
311
- inductance="356 microhenry"
312
- x=unit_registry.Quantity(inductance)
313
- if x:
314
- x=x.to("henry")
315
- inductance=decc(x.magnitude,cf=20)
316
- break
317
- except Exception as e:
318
- print(e)
319
- while True:
320
- try:
321
- capacitance=Control(func=FormBuilderMkText,ptext="capacitance[365 picofarads]? ",helpText="capacitance in farads",data="string")
322
- if capacitance is None:
323
- return
324
- elif capacitance in ['d',]:
325
- capacitance="365 picofarads"
326
- x=unit_registry.Quantity(capacitance)
327
- if x:
328
- x=x.to("farads")
329
- farads=decc(x.magnitude,cf=20)
330
- break
331
- except Exception as e:
332
- print(e)
333
- frequency=1/(decc(2*math.pi)*decc(math.sqrt(farads*inductance),cf=20))
334
- return unit_registry.Quantity(frequency,"hertz")
335
-
336
- def area_of_circle_diameter():
337
- '''
338
- A = πr²
339
- '''
340
- radius=0
341
- while True:
342
- try:
343
- diameter=Control(func=FormBuilderMkText,ptext="diameter unit[4 cm]? ",helpText="diamater value with unit",data="string")
344
- if diameter is None:
345
- return
346
- elif diameter in ['d',]:
347
- diameter="4 cm"
348
- x=unit_registry.Quantity(diameter)
349
- radius=pint.Quantity(decc(x.magnitude/2),x.units)
350
- break
351
- except Exception as e:
352
- print(e)
353
- if isinstance(radius,pint.registry.Quantity):
354
- result=decc(math.pi)*decc(radius.magnitude**2)
355
-
356
- return pint.Quantity(result,radius.units)
357
- else:
358
- return
359
-
360
3
 
361
4
  preloader={
362
5
  f'{uuid1()}':{
@@ -428,8 +71,8 @@ Here:
428
71
  'exec':lc_frequency,
429
72
  },
430
73
  f'{uuid1()}':{
431
- 'cmds':['area of a triangle',],
432
- 'desc':f'A=BH/2',
74
+ 'cmds':[i for i in generate_cmds(startcmd=['triangle','trngl'],endCmd=['area','a'])],
75
+ 'desc':f'A=BH/2 = area of a triangle',
433
76
  'exec':area_triangle,
434
77
  },
435
78
  f'{uuid1()}':{
@@ -463,25 +106,45 @@ Here:
463
106
  'exec':lambda: price_plus_crv_by_tax(total=True),
464
107
  },
465
108
  f'{uuid1()}':{
466
- 'cmds':['cylinder volume radius','cylvolrad','cyl vol rad'],
109
+ 'cmds':[i for i in generate_cmds(startcmd=['cylinder','clndr'],endCmd=['vol rad','volume radius'])],
467
110
  'desc':f'obtain the volume of a cylinder using radius',
468
111
  'exec':lambda: volumeCylinderRadius(),
469
112
  },
470
113
  f'{uuid1()}':{
471
- 'cmds':['cylinder volume diameter','cylvoldiam','cyl vol diam'],
114
+ 'cmds':[i for i in generate_cmds(startcmd=['cylinder','clndr'],endCmd=['vol diam','volume diameter'])],
472
115
  'desc':f'obtain the volume of a cylinder using diameter',
473
116
  'exec':lambda: volumeCylinderDiameter(),
474
117
  },
475
118
  f'{uuid1()}':{
476
- 'cmds':['cone volume radius','conevolrad','cone vol rad'],
477
- 'desc':f'obtain the volume of a cone using radius, a code is 1/3 of a cylinder at the same height and radius',
119
+ 'cmds':[i for i in generate_cmds(startcmd=['cone',],endCmd=['vol rad','volume radius'])],
120
+ 'desc':f'obtain the volume of a cone using radius, a cone is 1/3 of a cylinder at the same height and radius',
478
121
  'exec':lambda: volumeConeRadius(),
479
122
  },
480
123
  f'{uuid1()}':{
481
- 'cmds':['cone volume diameter','conevoldiam','cone vol diam'],
124
+ 'cmds':[i for i in generate_cmds(startcmd=['cone',],endCmd=['vol diam','volume diameter'])],
482
125
  'desc':f'obtain the volume of a cone using diameter, a code is 1/3 of a cylinder at the same height and diameter',
483
126
  'exec':lambda: volumeConeDiameter(),
484
127
  },
128
+ f'{uuid1()}':{
129
+ 'cmds':[i for i in generate_cmds(startcmd=['hemisphr','hemisphere'],endCmd=['vol rad','volume radius'])],
130
+ 'desc':f'obtain the volume of a hemisphere using radius',
131
+ 'exec':lambda: volumeHemisphereRadius(),
132
+ },
133
+ f'{uuid1()}':{
134
+ 'cmds':[i for i in generate_cmds(startcmd=['hemisphr','hemisphere'],endCmd=['vol diam','volume diameter'])],
135
+ 'desc':f'obtain the volume of a hemisphere using diameter',
136
+ 'exec':lambda: volumeHemisphereDiameter(),
137
+ },
138
+ f'{uuid1()}':{
139
+ 'cmds':[i for i in generate_cmds(startcmd=['circle',],endCmd=['area radius','area rad'])],
140
+ 'desc':f'obtain the area of a circle using radius',
141
+ 'exec':lambda: areaCircleRadius(),
142
+ },
143
+ f'{uuid1()}':{
144
+ 'cmds':[i for i in generate_cmds(startcmd=['circle',],endCmd=['area diameter','area diam'])],
145
+ 'desc':f'obtain the area of a circle using diameter',
146
+ 'exec':lambda: areaCircleDiameter(),
147
+ },
485
148
  f'{uuid1()}':{
486
149
  'cmds':['herons formula','hrns fmla'],
487
150
  'desc':f'''