dimcheck


Namedimcheck JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/Tony1527/dimcheck
SummaryA physics dimension checker based on sympy
upload_time2024-01-28 07:13:46
maintainer
docs_urlNone
authorTony Riddick
requires_python>=3.7
license
keywords physics dimension dimension analysis unit checker dimension checker sympy 量纲分析 量纲检查 单位检查 量纲 单位 sympy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # dimcheck: A physics dimension checker based on sympy

- [dimcheck: A physics dimension checker based on sympy](#dimcheck-a-physics-dimension-checker-based-on-sympy)
  - [Description](#description)
  - [Dependencies](#dependencies)
  - [Installation](#installation)
  - [Basic usage](#basic-usage)
  - [Convention](#convention)
  - [Advanced Usage](#advanced-usage)
    - [Pretty printing](#pretty-printing)
    - [Quantity Mode: Simpler format for inputting quantities](#quantity-mode-simpler-format-for-inputting-quantities)
    - [Customized definition of the quantities](#customized-definition-of-the-quantities)
    - [Serialization](#serialization)
    - [Save and display all quantities or expressions](#save-and-display-all-quantities-or-expressions)
  - [Methods](#methods)
    - [Property](#property)
    - [Dimension \& Units](#dimension--units)
    - [Derive Formula](#derive-formula)
    - [Save, clean and display](#save-clean-and-display)

## Description
Dimcheck is a Python library that provides an interface for users to check, compare and manipulate dimensions of quantities. It is especially useful in scientific computing and physics, where ensuring correct dimensions is crucial.

## Dependencies
```
python3
sympy
numpy
```


## Installation

You can install the package using pip,
```
pip install dimcheck
```
## Basic usage

You can try the package as follows,
```python
# Import the package, the package requires some time to initialize the global instance "si". You can make the process faster by serialization in the later section.
>>> from dimcheck import si
Starting to parse the quantity definition file: 
/to/your/pip/lib/path/packages/dimcheck/si.json
Successfully parsed!

# Get the dimension of quantity [E]. All quantities are represented by a symbol wrapped with a square bracket.
>>> si.dim("E")   
'M*L**2/T**2'

# Get the dimension of combination quantities [m*v**2] which is same as [E].
>>> si.dim("m*v**2")  
'M*L**2/T**2'

# Get the unit of combination quantities [m*v**2].
>>> si.unit("m*v**2")  
'kg*m**2/s**2'

# Check whether two quantities have the same dimension/unit.
>>> si.is_dc("E","m*v**2")  
True

# Derive the possible quantity of [G*m**2/r**2] which is the formula of Newton's law of universal gravitation. Here [G] is the gravitational Constant, [m] is the mass, [r] is the radius or length. You can replace the operator of the multiplication '*' with a space " ", and replace exponential operator "**" with "^". 
>>> si.quant("G m^2/r^2")   
'F'

# Derive the possible quantity based on the Ohm's law. Here [V] is the voltage, [I] is the current, [R] is the resistance which have the same dimension as the von Klitzing constant [R_K].
>>> si.quant("V/I")
['R', 'R_K']

# Restore the omitted quantity on the rhs. Here [hbar] is the reduced Planck constant, [k] is the wavenumber.
>>> si.omit_quant(lhs="E",rhs="k",omit_quant=["hbar","v"])  
'E = k*hbar*v'

# Derive the formula based on the given parameters. Here, we try to derive the pendulum formula.
>>> si.formula(lhs="t",parameters=["l","g"])   
't = l**(0.5)*g**(-0.5)'

# Display all quantities in the terminal.
>>> si.all_quant()
All Quantities:
B                 magnetic flux density, magnetic induction, B field           kg/(A*s**2)
C                 capacitance                                                  A**2*s**4/(kg*m**2)
D                 displacement field                                           A*s/m**2
...
None

# Save the definition of quantities in a ".csv" format file. By default, it will save to the "./Quantities.csv".
>>> si.save_all_quant()
True

# After switching to the "quantity" mode, one can remove the square brackets around symbols, which makes the whole formula more easy to write. This term is by default set to True.
>>> si.is_quant=True

# After switching to the "pretty" mode, all exponents will show as superscripts. This term is by default set to False.
>>> si.is_pretty=True
>>> si.quant("G m**2/r**2")  
'F'
>>> si.is_dc("E","m*v**2")  
True
>>> si.omit_quant(lhs="E",rhs="k",omit_quant=["hbar","v"])  
'E = k*hbar*v'
>>> si.unit("m*v**2")  
'kg*m²/s²'

# You can save these two modes by invoking si.save() method, then next time they will be the default mode.
>>> si.save()
True
```

The definition of all quantities and expressions locates in [Quantities.csv](./data/Quantities.csv) and [Expressions.csv](./data/Expressions.csv)


## Convention
1. Unit: The basic units  in `"si"` unit system (which is the only unit system so far) are `{"kg", "m", "s", "A", "mol", "cd", "K"}`.

2. Quantity: In the package, this term is a combination of the number 1 and units , e.g. `[v]` is the unit velocity whose unit is `"m/s"`.

3. Expression: The combination of basic units e.g. `"kg*m**2/s**2"` or dimensions `"M*L**2/T**2"`.

4. In the package, it will follow the same convention to represent a quantity as Ref. "Fly by Night Physics". For a quantity or a combination of quantities, they should be wrapped with square brackets. However, by default, the `si.is_quant=True`, so you do not need to worry about the square bracket when you are using those methods.
```python
>>> si.unit("F")
'kg*m/s**2'
>>> si.quant("e**2/hbar")
['conductance', 'sigma_2D']
```


5. You can replace `**` with `^` to represent the exponent. Also, the multiplication `*` can be simply replaced with a space ` `,
```python
>>> si.quant("m v^2")
'E'
```
There is also a few reserved keywords like `sqrt` and `cbrt` for convenience,
```python
>>> si.quant("sqrt(hbar e B v^2)")
'E'
```

6. You can write quantities without a square bracket as the following term is set to `True`,
```python
>>> si.is_quant=True
```
After that all quantities can be simply write as
```python
>>> si.unit("m v^2")
'kg*m**2/s**2'
```
The reason we introduce the square brackets is to distinguish quantities and base units. Since `[m]` represents the mass as the a quantity, `m` represents the base unit of length. So, if you only want to focus on the operation between quantities, and won't involve the base units in the formula, then we recommend you use the quantity mode as it is more convenient to write. Even though, the quantity mode work in the terminal, it is still required to wrap quantities when defining other quantities in the `Customized definition of the quantities` section.

## Advanced Usage

### Pretty printing
In the terminal mode, `Dimcheck` class (`si` is the instance of it) provides `is_pretty` property to make the results more easy to read.
```python
# Before setting "is_pretty" mode.
>>> si.is_pretty=False
>>> si.unit("m a")
'kg*m/s**2'

# After setting "is_pretty" mode.
>>> si.is_pretty=True
>>> si.unit("m a")
'kg*m/s²'

# Other methods
>>> si.is_dc("sqrt(hbar e B v**2)","E",is_print=True)
DC!
sqrt(hbar e B v²) == E (kg*m²/s²)
True

# Noted that "kg**(1/3)" will be shown as "kg¹ʴ³" since there is no other more proper symbol found in the Unicode for the division that appears at the exponent.
>>> si.unit("m**(1/3)")
'kg¹ʴ³'
```

### Quantity Mode: Simpler format for inputting quantities
In the terminal mode, `Dimcheck` class (si is an instance of it) provides `is_quant` property to make the quantities more easy to input.
```python
>>> si.is_quant=True
>>> si.quant("G m**2/r**2")  
'F'
>>> si.is_dc("E","m*v**2")  
True
>>> si.omit_quant(lhs="E",rhs="k",omit_quant="hbar","v")  
'E = k*hbar*v'
>>> si.unit("m*v**2")  
'kg*m**2/s**2'
```


### Customized definition of the quantities
In `dimcheck`, you can define your own quantities and symbols by simply manipulate the `si.json` file in the package directory. Here are some steps to define your own unit system.

1. Find the position of the package:
```python
>>> from dimcheck import si
Starting to parse the quantity definition file: 
/to/your/pip/lib/path/packages/dimcheck/si.json
Successfully parsed!

>>> si.quant_def_file
'/to/your/pip/lib/path/packages/dimcheck/si.json'
```

2. Add, delete or change the definition of symbols in the file. You need to be careful since the quantities should always be wrapped with a pair of square bracket `[]`. In the following example, the quantity `[epsilon_0]` is defined by the rhs `[Q]**2/([F]*[l]**2)`. Meanwhile, you can also give multiple aliases to the same quantity. Discription can be used to indicate the meaning of the quantity.
```json
{
    "quantity":"[epsilon_0]",
    "rhs":"[Q]**2/([F]*[l]**2)",
    "alias":["[eps_0]"],
    "discription":"vacuum dielectric constant"
}
```

3. After doing so, you can then import your definition by simply invoking
```python
# Import customized quantity definition.
>>> from dimcheck import si
Starting to parse the quantity definition file: 
/to/your/pip/lib/path/packages/dimcheck/si.json
Successfully parsed!

# Test your definition.
>>> si.unit("m v**2")
'kg*m**2/s**2'
>>> si.quant("m v**2")
'E'
```

In case, the `si.json` is modified, there is another copy of `si.json` at `data/si.json` in the repository.

### Serialization
Since sometimes loading `"si.json"` can be time-consuming, `dimcheck` provides the serialization to directly save the `Dimcheck` object (like `si`).
```python
# Serialize the instance
>>> si.save()
True

# The position of the file of quantity definition
>>> si.quant_def_file
'/to/your/pip/lib/path/packages/dimcheck/si.json'

# The position of the serialized file
>>> si.serialized_file
'/to/your/pip/lib/path/packages/dimcheck/si.pickle'

# Delete the serialized file
>>> si.clean()
True
```

### Save and display all quantities or expressions
`dimcheck` provides a few method to display and save the table of quantities and expressions. You can simply invoke the method,
```python
# Display all quantities in the terminal.
>>> si.all_quant()
All Quantities:
B                 magnetic flux density, magnetic induction, B field           kg/(A*s**2)
C                 capacitance                                                  A**2*s**4/(kg*m**2)
D                 displacement field                                           A*s/m**2
...

# Display all expressions with their aliases in the terminal.
>>> si.all_expr(is_inc_alias=True, is_sorted=True)
All Expression:
1                   alpha A['alp'] 
1/m                 k nabla A['nbl'] 
1/mol               N_A
...

# Make the output more easy to read
>>> si.is_pretty=True

>>> si.all_quant(is_sorted=False)
All Quantities:
m                  mass                           kg
t                  time                           s
...
rho_m              density of mass                kg/m³
v                  velocity                       m/s
a                  acceleration                   m/s²
g                  acceleration of gravity        m/s²
F                  force                          kg*m/s²

# Save quantities, by default the location will be "./Expressions.csv".
>>> si.save_all_expr()
True

# Save quantities to the path, by default the location will be "./Quantities.csv".
>>> si.save_all_quant(file_path="/path/to/output/Quantities.csv")
True
```
You can review above results from [Quantities.csv](./data/Quantities.csv) and [Expressions.csv](./data/Expressions.csv)
## Methods

### Property
| property    | Description           | Writable | Default |
| :---:       | :----------------     | :---:|    :---:|
| is_pretty   | The output is setting to be more easy to read (based on some symbols in UTF-8) or not. | Yes| True |
| is_quant   | Quantity mode | Yes| False |
| setting_file   | Returns the path of the global setting file.| No|   
| unit_system   | Returns the unit system.| No|  
| quant_def_file   | Returns the path of the file of quantity definition.| No|  
| serialized_file   | Returns the path of the serialized file.| No|  


### Dimension & Units
| method    | Description           |  Parameters   |   Return   |
| :---:     | :----------------     |   :---:       |  :-----:  |
| dim       | To get the dimension of a quantity. | s: str| expr: str|
| dimension | Alias of dim.          | s: str        |expr: str|
| is_dc     | To check whether two quantities are same. | lhs: str, rhs: str, is_print: bool=False | dc: bool |
| quant | To print the possible quantity by deriving the combination of quantities. | s: str, is_print=False| quantity: str or quantities: list|
| unit       | To get the unit of a quantity. | s: str| expr: str|

### Derive Formula
| method    | Description           |  Parameters   |   Return   |
| :---:     | :----------------     |   :---:       |  :-----:  |
| formula       | Print the formula of the target based on the parameters. | lhs : str, parameters : list| expr: str|
| omit_quant       | Restore the units of lhs based on the omitted quantities and rhs. | lhs : str, rhs : str, omit_quant: list| expr: str|




### Save, clean and display
| method    | Description           |  Parameters   |   Return |
| :---:     | :----------------     |   :---:       |:---: |
| all_expr | To display all expressions based on the quantity definition file. | is_inc_alias: bool=False, is_sorted: bool=True||
| all_quant | To display all quantities based on the quantity definition file. | is_inc_alias: bool=False, is_sorted: bool=True||
| clean | To clean the binary serialized file of the current object. | | success: bool|
| save  | To save the binary serialized file of the current object.  | | success: bool|
| save_all_expr | To save all expression in ".csv" format based on the quantity definition file. | file_path='./Expressions.csv', is_sorted: bool=True| success: bool|
| save_all_quant | To save all quantities in ".csv" format based on the quantity definition file. | file_path='./Quantities.csv', is_sorted: bool=True|success: bool|


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Tony1527/dimcheck",
    "name": "dimcheck",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "physics,dimension,dimension analysis,unit checker,dimension checker,sympy,\u91cf\u7eb2\u5206\u6790,\u91cf\u7eb2\u68c0\u67e5,\u5355\u4f4d\u68c0\u67e5,\u91cf\u7eb2,\u5355\u4f4d,sympy",
    "author": "Tony Riddick",
    "author_email": "tonyriddick1527@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f6/41/02ad9b4ac3d4733bb31ffffb3edd10786db1c40b4e9c6494697f22469cc7/dimcheck-1.0.2.tar.gz",
    "platform": null,
    "description": "# dimcheck: A physics dimension checker based on sympy\n\n- [dimcheck: A physics dimension checker based on sympy](#dimcheck-a-physics-dimension-checker-based-on-sympy)\n  - [Description](#description)\n  - [Dependencies](#dependencies)\n  - [Installation](#installation)\n  - [Basic usage](#basic-usage)\n  - [Convention](#convention)\n  - [Advanced Usage](#advanced-usage)\n    - [Pretty printing](#pretty-printing)\n    - [Quantity Mode: Simpler format for inputting quantities](#quantity-mode-simpler-format-for-inputting-quantities)\n    - [Customized definition of the quantities](#customized-definition-of-the-quantities)\n    - [Serialization](#serialization)\n    - [Save and display all quantities or expressions](#save-and-display-all-quantities-or-expressions)\n  - [Methods](#methods)\n    - [Property](#property)\n    - [Dimension \\& Units](#dimension--units)\n    - [Derive Formula](#derive-formula)\n    - [Save, clean and display](#save-clean-and-display)\n\n## Description\nDimcheck is a Python library that provides an interface for users to check, compare and manipulate dimensions of quantities. It is especially useful in scientific computing and physics, where ensuring correct dimensions is crucial.\n\n## Dependencies\n```\npython3\nsympy\nnumpy\n```\n\n\n## Installation\n\nYou can install the package using pip,\n```\npip install dimcheck\n```\n## Basic usage\n\nYou can try the package as follows,\n```python\n# Import the package, the package requires some time to initialize the global instance \"si\". You can make the process faster by serialization in the later section.\n>>> from dimcheck import si\nStarting to parse the quantity definition file: \n/to/your/pip/lib/path/packages/dimcheck/si.json\nSuccessfully parsed!\n\n# Get the dimension of quantity [E]. All quantities are represented by a symbol wrapped with a square bracket.\n>>> si.dim(\"E\")   \n'M*L**2/T**2'\n\n# Get the dimension of combination quantities [m*v**2] which is same as [E].\n>>> si.dim(\"m*v**2\")  \n'M*L**2/T**2'\n\n# Get the unit of combination quantities [m*v**2].\n>>> si.unit(\"m*v**2\")  \n'kg*m**2/s**2'\n\n# Check whether two quantities have the same dimension/unit.\n>>> si.is_dc(\"E\",\"m*v**2\")  \nTrue\n\n# Derive the possible quantity of [G*m**2/r**2] which is the formula of Newton's law of universal gravitation. Here [G] is the gravitational Constant, [m] is the mass, [r] is the radius or length. You can replace the operator of the multiplication '*' with a space \" \", and replace exponential operator \"**\" with \"^\". \n>>> si.quant(\"G m^2/r^2\")   \n'F'\n\n# Derive the possible quantity based on the Ohm's law. Here [V] is the voltage, [I] is the current, [R] is the resistance which have the same dimension as the von Klitzing constant [R_K].\n>>> si.quant(\"V/I\")\n['R', 'R_K']\n\n# Restore the omitted quantity on the rhs. Here [hbar] is the reduced Planck constant, [k] is the wavenumber.\n>>> si.omit_quant(lhs=\"E\",rhs=\"k\",omit_quant=[\"hbar\",\"v\"])  \n'E = k*hbar*v'\n\n# Derive the formula based on the given parameters. Here, we try to derive the pendulum formula.\n>>> si.formula(lhs=\"t\",parameters=[\"l\",\"g\"])   \n't = l**(0.5)*g**(-0.5)'\n\n# Display all quantities in the terminal.\n>>> si.all_quant()\nAll Quantities:\nB                 magnetic flux density, magnetic induction, B field           kg/(A*s**2)\nC                 capacitance                                                  A**2*s**4/(kg*m**2)\nD                 displacement field                                           A*s/m**2\n...\nNone\n\n# Save the definition of quantities in a \".csv\" format file. By default, it will save to the \"./Quantities.csv\".\n>>> si.save_all_quant()\nTrue\n\n# After switching to the \"quantity\" mode, one can remove the square brackets around symbols, which makes the whole formula more easy to write. This term is by default set to True.\n>>> si.is_quant=True\n\n# After switching to the \"pretty\" mode, all exponents will show as superscripts. This term is by default set to False.\n>>> si.is_pretty=True\n>>> si.quant(\"G m**2/r**2\")  \n'F'\n>>> si.is_dc(\"E\",\"m*v**2\")  \nTrue\n>>> si.omit_quant(lhs=\"E\",rhs=\"k\",omit_quant=[\"hbar\",\"v\"])  \n'E = k*hbar*v'\n>>> si.unit(\"m*v**2\")  \n'kg*m\u00b2/s\u00b2'\n\n# You can save these two modes by invoking si.save() method, then next time they will be the default mode.\n>>> si.save()\nTrue\n```\n\nThe definition of all quantities and expressions locates in [Quantities.csv](./data/Quantities.csv) and [Expressions.csv](./data/Expressions.csv)\n\n\n## Convention\n1. Unit: The basic units  in `\"si\"` unit system (which is the only unit system so far) are `{\"kg\", \"m\", \"s\", \"A\", \"mol\", \"cd\", \"K\"}`.\n\n2. Quantity: In the package, this term is a combination of the number 1 and units , e.g. `[v]` is the unit velocity whose unit is `\"m/s\"`.\n\n3. Expression: The combination of basic units e.g. `\"kg*m**2/s**2\"` or dimensions `\"M*L**2/T**2\"`.\n\n4. In the package, it will follow the same convention to represent a quantity as Ref. \"Fly by Night Physics\". For a quantity or a combination of quantities, they should be wrapped with square brackets. However, by default, the `si.is_quant=True`, so you do not need to worry about the square bracket when you are using those methods.\n```python\n>>> si.unit(\"F\")\n'kg*m/s**2'\n>>> si.quant(\"e**2/hbar\")\n['conductance', 'sigma_2D']\n```\n\n\n5. You can replace `**` with `^` to represent the exponent. Also, the multiplication `*` can be simply replaced with a space ` `,\n```python\n>>> si.quant(\"m v^2\")\n'E'\n```\nThere is also a few reserved keywords like `sqrt` and `cbrt` for convenience,\n```python\n>>> si.quant(\"sqrt(hbar e B v^2)\")\n'E'\n```\n\n6. You can write quantities without a square bracket as the following term is set to `True`,\n```python\n>>> si.is_quant=True\n```\nAfter that all quantities can be simply write as\n```python\n>>> si.unit(\"m v^2\")\n'kg*m**2/s**2'\n```\nThe reason we introduce the square brackets is to distinguish quantities and base units. Since `[m]` represents the mass as the a quantity, `m` represents the base unit of length. So, if you only want to focus on the operation between quantities, and won't involve the base units in the formula, then we recommend you use the quantity mode as it is more convenient to write. Even though, the quantity mode work in the terminal, it is still required to wrap quantities when defining other quantities in the `Customized definition of the quantities` section.\n\n## Advanced Usage\n\n### Pretty printing\nIn the terminal mode, `Dimcheck` class (`si` is the instance of it) provides `is_pretty` property to make the results more easy to read.\n```python\n# Before setting \"is_pretty\" mode.\n>>> si.is_pretty=False\n>>> si.unit(\"m a\")\n'kg*m/s**2'\n\n# After setting \"is_pretty\" mode.\n>>> si.is_pretty=True\n>>> si.unit(\"m a\")\n'kg*m/s\u00b2'\n\n# Other methods\n>>> si.is_dc(\"sqrt(hbar e B v**2)\",\"E\",is_print=True)\nDC!\nsqrt(hbar e B v\u00b2) == E (kg*m\u00b2/s\u00b2)\nTrue\n\n# Noted that \"kg**(1/3)\" will be shown as \"kg\u00b9\u02b4\u00b3\" since there is no other more proper symbol found in the Unicode for the division that appears at the exponent.\n>>> si.unit(\"m**(1/3)\")\n'kg\u00b9\u02b4\u00b3'\n```\n\n### Quantity Mode: Simpler format for inputting quantities\nIn the terminal mode, `Dimcheck` class (si is an instance of it) provides `is_quant` property to make the quantities more easy to input.\n```python\n>>> si.is_quant=True\n>>> si.quant(\"G m**2/r**2\")  \n'F'\n>>> si.is_dc(\"E\",\"m*v**2\")  \nTrue\n>>> si.omit_quant(lhs=\"E\",rhs=\"k\",omit_quant=\"hbar\",\"v\")  \n'E = k*hbar*v'\n>>> si.unit(\"m*v**2\")  \n'kg*m**2/s**2'\n```\n\n\n### Customized definition of the quantities\nIn `dimcheck`, you can define your own quantities and symbols by simply manipulate the `si.json` file in the package directory. Here are some steps to define your own unit system.\n\n1. Find the position of the package:\n```python\n>>> from dimcheck import si\nStarting to parse the quantity definition file: \n/to/your/pip/lib/path/packages/dimcheck/si.json\nSuccessfully parsed!\n\n>>> si.quant_def_file\n'/to/your/pip/lib/path/packages/dimcheck/si.json'\n```\n\n2. Add, delete or change the definition of symbols in the file. You need to be careful since the quantities should always be wrapped with a pair of square bracket `[]`. In the following example, the quantity `[epsilon_0]` is defined by the rhs `[Q]**2/([F]*[l]**2)`. Meanwhile, you can also give multiple aliases to the same quantity. Discription can be used to indicate the meaning of the quantity.\n```json\n{\n    \"quantity\":\"[epsilon_0]\",\n    \"rhs\":\"[Q]**2/([F]*[l]**2)\",\n    \"alias\":[\"[eps_0]\"],\n    \"discription\":\"vacuum dielectric constant\"\n}\n```\n\n3. After doing so, you can then import your definition by simply invoking\n```python\n# Import customized quantity definition.\n>>> from dimcheck import si\nStarting to parse the quantity definition file: \n/to/your/pip/lib/path/packages/dimcheck/si.json\nSuccessfully parsed!\n\n# Test your definition.\n>>> si.unit(\"m v**2\")\n'kg*m**2/s**2'\n>>> si.quant(\"m v**2\")\n'E'\n```\n\nIn case, the `si.json` is modified, there is another copy of `si.json` at `data/si.json` in the repository.\n\n### Serialization\nSince sometimes loading `\"si.json\"` can be time-consuming, `dimcheck` provides the serialization to directly save the `Dimcheck` object (like `si`).\n```python\n# Serialize the instance\n>>> si.save()\nTrue\n\n# The position of the file of quantity definition\n>>> si.quant_def_file\n'/to/your/pip/lib/path/packages/dimcheck/si.json'\n\n# The position of the serialized file\n>>> si.serialized_file\n'/to/your/pip/lib/path/packages/dimcheck/si.pickle'\n\n# Delete the serialized file\n>>> si.clean()\nTrue\n```\n\n### Save and display all quantities or expressions\n`dimcheck` provides a few method to display and save the table of quantities and expressions. You can simply invoke the method,\n```python\n# Display all quantities in the terminal.\n>>> si.all_quant()\nAll Quantities:\nB                 magnetic flux density, magnetic induction, B field           kg/(A*s**2)\nC                 capacitance                                                  A**2*s**4/(kg*m**2)\nD                 displacement field                                           A*s/m**2\n...\n\n# Display all expressions with their aliases in the terminal.\n>>> si.all_expr(is_inc_alias=True, is_sorted=True)\nAll Expression:\n1                   alpha A['alp'] \n1/m                 k nabla A['nbl'] \n1/mol               N_A\n...\n\n# Make the output more easy to read\n>>> si.is_pretty=True\n\n>>> si.all_quant(is_sorted=False)\nAll Quantities:\nm                  mass                           kg\nt                  time                           s\n...\nrho_m              density of mass                kg/m\u00b3\nv                  velocity                       m/s\na                  acceleration                   m/s\u00b2\ng                  acceleration of gravity        m/s\u00b2\nF                  force                          kg*m/s\u00b2\n\n# Save quantities, by default the location will be \"./Expressions.csv\".\n>>> si.save_all_expr()\nTrue\n\n# Save quantities to the path, by default the location will be \"./Quantities.csv\".\n>>> si.save_all_quant(file_path=\"/path/to/output/Quantities.csv\")\nTrue\n```\nYou can review above results from [Quantities.csv](./data/Quantities.csv) and [Expressions.csv](./data/Expressions.csv)\n## Methods\n\n### Property\n| property    | Description           | Writable | Default |\n| :---:       | :----------------     | :---:|    :---:|\n| is_pretty   | The output is setting to be more easy to read (based on some symbols in UTF-8) or not. | Yes| True |\n| is_quant   | Quantity mode | Yes| False |\n| setting_file   | Returns the path of the global setting file.| No|   \n| unit_system   | Returns the unit system.| No|  \n| quant_def_file   | Returns the path of the file of quantity definition.| No|  \n| serialized_file   | Returns the path of the serialized file.| No|  \n\n\n### Dimension & Units\n| method    | Description           |  Parameters   |   Return   |\n| :---:     | :----------------     |   :---:       |  :-----:  |\n| dim       | To get the dimension of a quantity. | s: str| expr: str|\n| dimension | Alias of dim.          | s: str        |expr: str|\n| is_dc     | To check whether two quantities are same. | lhs: str, rhs: str, is_print: bool=False | dc: bool |\n| quant | To print the possible quantity by deriving the combination of quantities. | s: str, is_print=False| quantity: str or quantities: list|\n| unit       | To get the unit of a quantity. | s: str| expr: str|\n\n### Derive Formula\n| method    | Description           |  Parameters   |   Return   |\n| :---:     | :----------------     |   :---:       |  :-----:  |\n| formula       | Print the formula of the target based on the parameters. | lhs : str, parameters : list| expr: str|\n| omit_quant       | Restore the units of lhs based on the omitted quantities and rhs. | lhs : str, rhs : str, omit_quant: list| expr: str|\n\n\n\n\n### Save, clean and display\n| method    | Description           |  Parameters   |   Return |\n| :---:     | :----------------     |   :---:       |:---: |\n| all_expr | To display all expressions based on the quantity definition file. | is_inc_alias: bool=False, is_sorted: bool=True||\n| all_quant | To display all quantities based on the quantity definition file. | is_inc_alias: bool=False, is_sorted: bool=True||\n| clean | To clean the binary serialized file of the current object. | | success: bool|\n| save  | To save the binary serialized file of the current object.  | | success: bool|\n| save_all_expr | To save all expression in \".csv\" format based on the quantity definition file. | file_path='./Expressions.csv', is_sorted: bool=True| success: bool|\n| save_all_quant | To save all quantities in \".csv\" format based on the quantity definition file. | file_path='./Quantities.csv', is_sorted: bool=True|success: bool|\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A physics dimension checker based on sympy",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/Tony1527/dimcheck"
    },
    "split_keywords": [
        "physics",
        "dimension",
        "dimension analysis",
        "unit checker",
        "dimension checker",
        "sympy",
        "\u91cf\u7eb2\u5206\u6790",
        "\u91cf\u7eb2\u68c0\u67e5",
        "\u5355\u4f4d\u68c0\u67e5",
        "\u91cf\u7eb2",
        "\u5355\u4f4d",
        "sympy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f3f3c3ecd6584e36743e035ffbda3dc650e52fb9f47090890b7c363511df1713",
                "md5": "83571f5cd462feb65dd118436992de31",
                "sha256": "a19233299e09c1166dfbdc7972fb7d41efaf6a88657806d644dbd9019de23fa8"
            },
            "downloads": -1,
            "filename": "dimcheck-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "83571f5cd462feb65dd118436992de31",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 36404,
            "upload_time": "2024-01-28T07:13:44",
            "upload_time_iso_8601": "2024-01-28T07:13:44.086899Z",
            "url": "https://files.pythonhosted.org/packages/f3/f3/c3ecd6584e36743e035ffbda3dc650e52fb9f47090890b7c363511df1713/dimcheck-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f64102ad9b4ac3d4733bb31ffffb3edd10786db1c40b4e9c6494697f22469cc7",
                "md5": "bbb601acaf77089ccbab643237c8ea56",
                "sha256": "a0b7867c3748e95438176e99c80eeee9d81dc6cc98410a73a363531bfb4c9710"
            },
            "downloads": -1,
            "filename": "dimcheck-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "bbb601acaf77089ccbab643237c8ea56",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 26983,
            "upload_time": "2024-01-28T07:13:46",
            "upload_time_iso_8601": "2024-01-28T07:13:46.586840Z",
            "url": "https://files.pythonhosted.org/packages/f6/41/02ad9b4ac3d4733bb31ffffb3edd10786db1c40b4e9c6494697f22469cc7/dimcheck-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-28 07:13:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Tony1527",
    "github_project": "dimcheck",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "dimcheck"
}
        
Elapsed time: 0.21437s