Repository: uncscode/particula

Issue:
make environment the base class
rewrite env class to make it base and build particle on top of it

Discussion:
sourcery-ai[bot]: # Sourcery Code Quality Report

✅ &nbsp;Merging this PR will **increase** code quality in the affected files by **4.26%**.

| Quality metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| [Complexity](https://docs.sourcery.ai/GitHub/Quality-Report/#complexity) | 0.00 ⭐ | 0.00 ⭐ | 0.00  |
| [Method Length](https://docs.sourcery.ai/GitHub/Quality-Report/#method-length) | 23.80 ⭐ | 19.82 ⭐ | -3.98 👍 |
| [Working memory](https://docs.sourcery.ai/GitHub/Quality-Report/#working-memory) | 6.04 ⭐ | 4.44 ⭐ | -1.60 👍 |
| **[Quality](https://docs.sourcery.ai/GitHub/Quality-Report/#quality-score)** | **88.96%** ⭐| **93.22%** ⭐| **4.26%** 👍 |

| Other metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| Lines | 89 | 84 | -5 |

| Changed files | Quality Before | Quality After | Quality Change |
| --- | :---: | :---: | :---: |
| particula/environment.py | 87.31% ⭐ | 99.67% ⭐ | 12.36% 👍|
| particula/tests/environment_test.py | 92.06% ⭐ | 88.93% ⭐ | -3.13% 👎|

Here are some functions in these files that still need a tune-up:

| File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
| --- | --- | :---: | :---: | :---: | :---: | --- |

## Legend and Explanation

The emojis denote the absolute quality of the code:

 - ⭐ excellent
 - 🙂 good
 - 😞 poor
 - ⛔ very poor


The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.

***

Please see our documentation [here](https://docs.sourcery.ai/GitHub/Quality-Report/) for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us [improve](https://research.typeform.com/to/j06Spdfr?type=quality_report&github_login=ngam&base_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&base_remote_ref=refs%2Fpull%2F167%2Fhead&base_ref=main&base_sha=44985318e89b9447f66afea59146d7bd51de0da1&head_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&head_ref=sourcery%2Fpull-167&base_pr_number=167&base_pr_state=open) this quality report!
sourcery-ai[bot]: # Sourcery Code Quality Report

✅ &nbsp;Merging this PR will **increase** code quality in the affected files by **1.22%**.

| Quality metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| [Complexity](https://docs.sourcery.ai/GitHub/Quality-Report/#complexity) | 0.99 ⭐ | 0.99 ⭐ | 0.00  |
| [Method Length](https://docs.sourcery.ai/GitHub/Quality-Report/#method-length) | 38.23 ⭐ | 35.81 ⭐ | -2.42 👍 |
| [Working memory](https://docs.sourcery.ai/GitHub/Quality-Report/#working-memory) | 8.37 🙂 | 7.98 🙂 | -0.39 👍 |
| **[Quality](https://docs.sourcery.ai/GitHub/Quality-Report/#quality-score)** | **78.45%** ⭐| **79.67%** ⭐| **1.22%** 👍 |

| Other metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| Lines | 525 | 512 | -13 |

| Changed files | Quality Before | Quality After | Quality Change |
| --- | :---: | :---: | :---: |
| particula/environment.py | 87.31% ⭐ | 99.67% ⭐ | 12.36% 👍|
| particula/particle.py | 75.18% ⭐ | 75.18% ⭐ | 0.00% |
| particula/tests/environment_test.py | 92.06% ⭐ | 89.83% ⭐ | -2.23% 👎|

Here are some functions in these files that still need a tune-up:

| File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
| --- | --- | :---: | :---: | :---: | :---: | --- |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_parameterized | 6 ⭐ | 229 ⛔ | 16 ⛔ | 41.51% 😞 | Try splitting into smaller methods. Extract out complex expressions |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_hard\_sphere | 0 ⭐ | 90 🙂 | 13 😞 | 65.20% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensioned\_coagulation\_kernel | 0 ⭐ | 67 🙂 | 13 😞 | 68.61% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.coulomb\_potential\_ratio | 0 ⭐ | 58 ⭐ | 11 😞 | 73.32% 🙂 | Extract out complex expressions |

## Legend and Explanation

The emojis denote the absolute quality of the code:

 - ⭐ excellent
 - 🙂 good
 - 😞 poor
 - ⛔ very poor


The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.

***

Please see our documentation [here](https://docs.sourcery.ai/GitHub/Quality-Report/) for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us [improve](https://research.typeform.com/to/j06Spdfr?type=quality_report&github_login=ngam&base_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&base_remote_ref=refs%2Fpull%2F167%2Fhead&base_ref=main&base_sha=ea9ab17ea63d240480c07310afe8c7b42d29b8b1&head_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&head_ref=sourcery%2Fpull-167&base_pr_number=167&base_pr_state=open) this quality report!
sourcery-ai[bot]: # Sourcery Code Quality Report

✅ &nbsp;Merging this PR will **increase** code quality in the affected files by **1.22%**.

| Quality metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| [Complexity](https://docs.sourcery.ai/GitHub/Quality-Report/#complexity) | 0.99 ⭐ | 0.99 ⭐ | 0.00  |
| [Method Length](https://docs.sourcery.ai/GitHub/Quality-Report/#method-length) | 38.23 ⭐ | 35.81 ⭐ | -2.42 👍 |
| [Working memory](https://docs.sourcery.ai/GitHub/Quality-Report/#working-memory) | 8.37 🙂 | 7.98 🙂 | -0.39 👍 |
| **[Quality](https://docs.sourcery.ai/GitHub/Quality-Report/#quality-score)** | **78.45%** ⭐| **79.67%** ⭐| **1.22%** 👍 |

| Other metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| Lines | 525 | 534 | 9 |

| Changed files | Quality Before | Quality After | Quality Change |
| --- | :---: | :---: | :---: |
| particula/environment.py | 87.31% ⭐ | 99.67% ⭐ | 12.36% 👍|
| particula/particle.py | 75.18% ⭐ | 75.18% ⭐ | 0.00% |
| particula/tests/environment_test.py | 92.06% ⭐ | 89.83% ⭐ | -2.23% 👎|

Here are some functions in these files that still need a tune-up:

| File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
| --- | --- | :---: | :---: | :---: | :---: | --- |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_parameterized | 6 ⭐ | 229 ⛔ | 16 ⛔ | 41.51% 😞 | Try splitting into smaller methods. Extract out complex expressions |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_hard\_sphere | 0 ⭐ | 90 🙂 | 13 😞 | 65.20% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensioned\_coagulation\_kernel | 0 ⭐ | 67 🙂 | 13 😞 | 68.61% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.coulomb\_potential\_ratio | 0 ⭐ | 58 ⭐ | 11 😞 | 73.32% 🙂 | Extract out complex expressions |

## Legend and Explanation

The emojis denote the absolute quality of the code:

 - ⭐ excellent
 - 🙂 good
 - 😞 poor
 - ⛔ very poor


The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.

***

Please see our documentation [here](https://docs.sourcery.ai/GitHub/Quality-Report/) for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us [improve](https://research.typeform.com/to/j06Spdfr?type=quality_report&github_login=ngam&base_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&base_remote_ref=refs%2Fpull%2F167%2Fhead&base_ref=main&base_sha=98dc1ea33002e87d1c0889edf019cd447b199531&head_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&head_ref=sourcery%2Fpull-167&base_pr_number=167&base_pr_state=open) this quality report!
wkchuang: > Fixes #166
> 
> Idea: `Environment` will be our base class, for now taking only* two inputs (pressure, temperature) and outputting four things (pressure, temperature, viscosity, mfp). Then, we build Particle on top of Environment, thus inheriting all the above without having to re-input/re-output them. This will make Environment more or less a hidden class. We can expand the inputs and outputs of Environment as we see fit later, and as we organize the other classes on top of it.
> 
> To prepare you for the way ahead: Particle will inherit from Environment; Then ParticleDistribution will either be blended into Particle or will be built on top of it; then CoagulationRate, CondensationRate, etc. are built on top of ParticleDistribution. However, we will likely need another class for Vapor, but I will need to think more about where in the sequence that belongs. It will likely have to be right before Particle because in reality, particles come from Vapor components (nucleation + condensation), so "etymologically" something like this would make most sense, but Vapor treatment is pretty advanced and will take some time. By vapor(s), I mean gaseous precursors (but not the medium itself; the medium is Environment).
> 
> `Environment > Vapor > Particle > Rates > ..`
> 
> Highlights:
> 
>     * relies on utils instead of in-class methods
> 
>     * ensures multi-dim inputs work correctly
> 
>     * removed units checks (relying instead on input_handling utils)
> 
>     * removed `_air` from names as the utils actually apply to more than air (but for all practical purposes, we will be dealing only with air)
> 
> 
> TODO:
> 
>     * [ ]  decide if to document the kwargs stuff here (it is fully documented in utils)
> 
>     * [ ]  add more rigorous testing
> 
>     * [ ]  remove getters (no need to output pressure/temperature anymore; requires fixes in downstream in particle, parcel)
> 
> 
> DO NOT MERGE as we should finalize some things before merging.
> 
> NOTE:
> 
>     * *in reality, kwargs allow for many more inputs including overriding utils and constants. See added notes atop the class.

Sounds good! I like how we're organizing the hierarchy. I'll take a closer review tonight.
ngam: Thanks @wkchuang, please think about where and how we should organize the inputs/outputs. 

I am leaning towards the idea to never let utilities access **kwargs and instead they should be defined explicitly. For example,

dynamic_viscosity.py currently has:
```python
def dyn_vis(**kwargs):

    temp = kwargs.get("temperature", 298.15)
    ref_vis = kwargs.get("reference_viscosity", REF_VISCOSITY_AIR_STP)
    ref_temp = kwargs.get("reference_temperature", REF_TEMPERATURE_STP)

    temp = in_temperature(temp)
    ref_vis = in_viscosity(ref_vis)
    ref_temp = in_temperature(ref_temp)

    suth_const = SUTHERLAND_CONSTANT

    return (
        ref_vis * (temp/ref_temp)**(3/2) * (ref_temp + suth_const) /
        (temp + suth_const)
    )
```

instead, we move the kwargs from that file to the environment.py file, and we define stuff explicitly inside the utility:

dynamic_viscosity.py will have:

```python
def dyn_vis(temp=298.15*u.K, ref_vis=..., ref_temp=..., suth_const=...,):

    return (
        ref_vis * (temp/ref_temp)**(3/2) * (ref_temp + suth_const) /
        (temp + suth_const)
    )
```
ngam: This cosmetic may be beneficial when it comes to never having to check inside the utilities again (there's a reason they're hidden in util, right?) but I am not 100% sure. So I would like to hear from you what makes more sense in terms of organizing inputs/outputs. Main idea: never repeat an input.
sourcery-ai[bot]: # Sourcery Code Quality Report

❌ &nbsp;Merging this PR will **decrease** code quality in the affected files by **0.86%**.

| Quality metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| [Complexity](https://docs.sourcery.ai/GitHub/Quality-Report/#complexity) | 2.36 ⭐ | 2.58 ⭐ | 0.22 👎 |
| [Method Length](https://docs.sourcery.ai/GitHub/Quality-Report/#method-length) | 39.73 ⭐ | 41.62 ⭐ | 1.89 👎 |
| [Working memory](https://docs.sourcery.ai/GitHub/Quality-Report/#working-memory) | 8.63 🙂 | 8.89 🙂 | 0.26 👎 |
| **[Quality](https://docs.sourcery.ai/GitHub/Quality-Report/#quality-score)** | **76.56%** ⭐| **75.70%** ⭐| **-0.86%** 👎 |

| Other metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| Lines | 1003 | 1086 | 83 |

| Changed files | Quality Before | Quality After | Quality Change |
| --- | :---: | :---: | :---: |
| particula/environment.py | 87.31% ⭐ | 86.99% ⭐ | -0.32% 👎|
| particula/particle.py | 75.18% ⭐ | 75.20% ⭐ | 0.02% 👍|
| particula/tests/environment_test.py | 92.06% ⭐ | 89.95% ⭐ | -2.11% 👎|
| particula/util/dynamic_viscosity.py | 83.67% ⭐ | 75.69% ⭐ | -7.98% 👎|
| particula/util/input_handling.py | 73.88% 🙂 | 73.14% 🙂 | -0.74% 👎|
| particula/util/mean_free_path.py | 69.96% 🙂 | 63.39% 🙂 | -6.57% 👎|

Here are some functions in these files that still need a tune-up:

| File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
| --- | --- | :---: | :---: | :---: | :---: | --- |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_parameterized | 6 ⭐ | 229 ⛔ | 16 ⛔ | 41.51% 😞 | Try splitting into smaller methods. Extract out complex expressions |
| particula/util/mean_free_path.py | mfp | 2 ⭐ | 79 🙂 | 14 😞 | 63.39% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_hard\_sphere | 0 ⭐ | 90 🙂 | 13 😞 | 65.20% 🙂 | Extract out complex expressions |
| particula/util/input_handling.py | in\_gas\_constant | 5 ⭐ | 60 ⭐ | 12 😞 | 66.31% 🙂 | Extract out complex expressions |
| particula/util/input_handling.py | in\_pressure | 5 ⭐ | 58 ⭐ | 11 😞 | 68.36% 🙂 | Extract out complex expressions |

## Legend and Explanation

The emojis denote the absolute quality of the code:

 - ⭐ excellent
 - 🙂 good
 - 😞 poor
 - ⛔ very poor


The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.

***

Please see our documentation [here](https://docs.sourcery.ai/GitHub/Quality-Report/) for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us [improve](https://research.typeform.com/to/j06Spdfr?type=quality_report&github_login=ngam&base_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&base_remote_ref=refs%2Fpull%2F167%2Fhead&base_ref=main&base_sha=c94023cd66932e42c6d23d87d41f44fb94da21d4&head_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&head_ref=sourcery%2Fpull-167&base_pr_number=167&base_pr_state=open) this quality report!
sourcery-ai[bot]: # Sourcery Code Quality Report

❌ &nbsp;Merging this PR will **decrease** code quality in the affected files by **0.98%**.

| Quality metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| [Complexity](https://docs.sourcery.ai/GitHub/Quality-Report/#complexity) | 2.36 ⭐ | 2.57 ⭐ | 0.21 👎 |
| [Method Length](https://docs.sourcery.ai/GitHub/Quality-Report/#method-length) | 39.73 ⭐ | 41.80 ⭐ | 2.07 👎 |
| [Working memory](https://docs.sourcery.ai/GitHub/Quality-Report/#working-memory) | 8.63 🙂 | 8.94 🙂 | 0.31 👎 |
| **[Quality](https://docs.sourcery.ai/GitHub/Quality-Report/#quality-score)** | **76.56%** ⭐| **75.58%** ⭐| **-0.98%** 👎 |

| Other metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| Lines | 1003 | 1088 | 85 |

| Changed files | Quality Before | Quality After | Quality Change |
| --- | :---: | :---: | :---: |
| particula/environment.py | 87.31% ⭐ | 86.99% ⭐ | -0.32% 👎|
| particula/particle.py | 75.18% ⭐ | 75.20% ⭐ | 0.02% 👍|
| particula/tests/environment_test.py | 92.06% ⭐ | 89.95% ⭐ | -2.11% 👎|
| particula/util/dynamic_viscosity.py | 83.67% ⭐ | 72.54% 🙂 | -11.13% 👎|
| particula/util/input_handling.py | 73.88% 🙂 | 73.14% 🙂 | -0.74% 👎|
| particula/util/mean_free_path.py | 69.96% 🙂 | 63.39% 🙂 | -6.57% 👎|

Here are some functions in these files that still need a tune-up:

| File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
| --- | --- | :---: | :---: | :---: | :---: | --- |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_parameterized | 6 ⭐ | 229 ⛔ | 16 ⛔ | 41.51% 😞 | Try splitting into smaller methods. Extract out complex expressions |
| particula/util/mean_free_path.py | mfp | 2 ⭐ | 79 🙂 | 14 😞 | 63.39% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_hard\_sphere | 0 ⭐ | 90 🙂 | 13 😞 | 65.20% 🙂 | Extract out complex expressions |
| particula/util/input_handling.py | in\_gas\_constant | 5 ⭐ | 60 ⭐ | 12 😞 | 66.31% 🙂 | Extract out complex expressions |
| particula/util/input_handling.py | in\_pressure | 5 ⭐ | 58 ⭐ | 11 😞 | 68.36% 🙂 | Extract out complex expressions |

## Legend and Explanation

The emojis denote the absolute quality of the code:

 - ⭐ excellent
 - 🙂 good
 - 😞 poor
 - ⛔ very poor


The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.

***

Please see our documentation [here](https://docs.sourcery.ai/GitHub/Quality-Report/) for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us [improve](https://research.typeform.com/to/j06Spdfr?type=quality_report&github_login=ngam&base_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&base_remote_ref=refs%2Fpull%2F167%2Fhead&base_ref=main&base_sha=594b97395bb2ff9b0d8f5032c60785795afe5661&head_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&head_ref=sourcery%2Fpull-167&base_pr_number=167&base_pr_state=open) this quality report!
wkchuang: > Thanks @wkchuang, please think about where and how we should organize the inputs/outputs.
> 
> I am leaning towards the idea to never let utilities access **kwargs and instead they should be defined explicitly. For example,
> 
> dynamic_viscosity.py currently has:
> 
> ```python
> def dyn_vis(**kwargs):
> 
>     temp = kwargs.get("temperature", 298.15)
>     ref_vis = kwargs.get("reference_viscosity", REF_VISCOSITY_AIR_STP)
>     ref_temp = kwargs.get("reference_temperature", REF_TEMPERATURE_STP)
> 
>     temp = in_temperature(temp)
>     ref_vis = in_viscosity(ref_vis)
>     ref_temp = in_temperature(ref_temp)
> 
>     suth_const = SUTHERLAND_CONSTANT
> 
>     return (
>         ref_vis * (temp/ref_temp)**(3/2) * (ref_temp + suth_const) /
>         (temp + suth_const)
>     )
> ```
> 
> instead, we move the kwargs from that file to the environment.py file, and we define stuff explicitly inside the utility:
> 
> dynamic_viscosity.py will have:
> 
> ```python
> def dyn_vis(temp=298.15*u.K, ref_vis=..., ref_temp=..., suth_const=...,):
> 
>     return (
>         ref_vis * (temp/ref_temp)**(3/2) * (ref_temp + suth_const) /
>         (temp + suth_const)
>     )
> ```
> 
> update: see example implementation in [c94023c](https://github.com/uncscode/particula/pull/167/commits/c94023cd66932e42c6d23d87d41f44fb94da21d4)

I like it this way, where the important inputs are explicitly stated so it's clearer to the reader.
sourcery-ai[bot]: # Sourcery Code Quality Report

❌ &nbsp;Merging this PR will **decrease** code quality in the affected files by **0.95%**.

| Quality metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| [Complexity](https://docs.sourcery.ai/GitHub/Quality-Report/#complexity) | 0.82 ⭐ | 0.98 ⭐ | 0.16 👎 |
| [Method Length](https://docs.sourcery.ai/GitHub/Quality-Report/#method-length) | 38.57 ⭐ | 40.68 ⭐ | 2.11 👎 |
| [Working memory](https://docs.sourcery.ai/GitHub/Quality-Report/#working-memory) | 8.44 🙂 | 8.73 🙂 | 0.29 👎 |
| **[Quality](https://docs.sourcery.ai/GitHub/Quality-Report/#quality-score)** | **78.05%** ⭐| **77.10%** ⭐| **-0.95%** 👎 |

| Other metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| Lines | 721 | 775 | 54 |

| Changed files | Quality Before | Quality After | Quality Change |
| --- | :---: | :---: | :---: |
| particula/environment.py | 87.31% ⭐ | 86.99% ⭐ | -0.32% 👎|
| particula/particle.py | 75.18% ⭐ | 75.20% ⭐ | 0.02% 👍|
| particula/tests/environment_test.py | 92.06% ⭐ | 89.95% ⭐ | -2.11% 👎|
| particula/util/dynamic_viscosity.py | 83.67% ⭐ | 72.54% 🙂 | -11.13% 👎|
| particula/util/mean_free_path.py | 69.96% 🙂 | 63.39% 🙂 | -6.57% 👎|

Here are some functions in these files that still need a tune-up:

| File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
| --- | --- | :---: | :---: | :---: | :---: | --- |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_parameterized | 6 ⭐ | 229 ⛔ | 16 ⛔ | 41.51% 😞 | Try splitting into smaller methods. Extract out complex expressions |
| particula/util/mean_free_path.py | mfp | 2 ⭐ | 79 🙂 | 14 😞 | 63.39% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_hard\_sphere | 0 ⭐ | 90 🙂 | 13 😞 | 65.20% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensioned\_coagulation\_kernel | 0 ⭐ | 67 🙂 | 13 😞 | 68.61% 🙂 | Extract out complex expressions |
| particula/util/dynamic_viscosity.py | dyn\_vis | 0 ⭐ | 63 🙂 | 11 😞 | 72.54% 🙂 | Extract out complex expressions |

## Legend and Explanation

The emojis denote the absolute quality of the code:

 - ⭐ excellent
 - 🙂 good
 - 😞 poor
 - ⛔ very poor


The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.

***

Please see our documentation [here](https://docs.sourcery.ai/GitHub/Quality-Report/) for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us [improve](https://research.typeform.com/to/j06Spdfr?type=quality_report&github_login=ngam&base_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&base_remote_ref=refs%2Fpull%2F167%2Fhead&base_ref=main&base_sha=6540a8a6e34a38cbd6cf7dc904c46549e6b640d6&head_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&head_ref=sourcery%2Fpull-167&base_pr_number=167&base_pr_state=open) this quality report!
sourcery-ai[bot]: # Sourcery Code Quality Report

❌ &nbsp;Merging this PR will **decrease** code quality in the affected files by **0.52%**.

| Quality metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| [Complexity](https://docs.sourcery.ai/GitHub/Quality-Report/#complexity) | 1.16 ⭐ | 1.27 ⭐ | 0.11 👎 |
| [Method Length](https://docs.sourcery.ai/GitHub/Quality-Report/#method-length) | 31.65 ⭐ | 32.61 ⭐ | 0.96 👎 |
| [Working memory](https://docs.sourcery.ai/GitHub/Quality-Report/#working-memory) | 7.81 🙂 | 7.98 🙂 | 0.17 👎 |
| **[Quality](https://docs.sourcery.ai/GitHub/Quality-Report/#quality-score)** | **80.60%** ⭐| **80.08%** ⭐| **-0.52%** 👎 |

| Other metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| Lines | 803 | 858 | 55 |

| Changed files | Quality Before | Quality After | Quality Change |
| --- | :---: | :---: | :---: |
| particula/environment.py | 87.31% ⭐ | 86.99% ⭐ | -0.32% 👎|
| particula/particle.py | 75.18% ⭐ | 75.20% ⭐ | 0.02% 👍|
| particula/tests/environment_test.py | 92.06% ⭐ | 89.95% ⭐ | -2.11% 👎|
| particula/util/dynamic_viscosity.py | 83.67% ⭐ | 72.54% 🙂 | -11.13% 👎|
| particula/util/input_handling.py | 87.68% ⭐ | 87.95% ⭐ | 0.27% 👍|
| particula/util/mean_free_path.py | 69.96% 🙂 | 63.39% 🙂 | -6.57% 👎|

Here are some functions in these files that still need a tune-up:

| File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
| --- | --- | :---: | :---: | :---: | :---: | --- |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_parameterized | 6 ⭐ | 229 ⛔ | 16 ⛔ | 41.51% 😞 | Try splitting into smaller methods. Extract out complex expressions |
| particula/util/mean_free_path.py | mfp | 2 ⭐ | 79 🙂 | 14 😞 | 63.39% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_hard\_sphere | 0 ⭐ | 90 🙂 | 13 😞 | 65.20% 🙂 | Extract out complex expressions |
| particula/util/input_handling.py | in\_handling | 5 ⭐ | 54 ⭐ | 12 😞 | 67.26% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensioned\_coagulation\_kernel | 0 ⭐ | 67 🙂 | 13 😞 | 68.61% 🙂 | Extract out complex expressions |

## Legend and Explanation

The emojis denote the absolute quality of the code:

 - ⭐ excellent
 - 🙂 good
 - 😞 poor
 - ⛔ very poor


The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.

***

Please see our documentation [here](https://docs.sourcery.ai/GitHub/Quality-Report/) for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us [improve](https://research.typeform.com/to/j06Spdfr?type=quality_report&github_login=ngam&base_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&base_remote_ref=refs%2Fpull%2F167%2Fhead&base_ref=main&base_sha=9d133869cac7de2178ba50cc749d6f436bfb6348&head_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&head_ref=sourcery%2Fpull-167&base_pr_number=167&base_pr_state=open) this quality report!
sourcery-ai[bot]: # Sourcery Code Quality Report

❌ &nbsp;Merging this PR will **decrease** code quality in the affected files by **0.54%**.

| Quality metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| [Complexity](https://docs.sourcery.ai/GitHub/Quality-Report/#complexity) | 1.16 ⭐ | 1.27 ⭐ | 0.11 👎 |
| [Method Length](https://docs.sourcery.ai/GitHub/Quality-Report/#method-length) | 31.65 ⭐ | 32.67 ⭐ | 1.02 👎 |
| [Working memory](https://docs.sourcery.ai/GitHub/Quality-Report/#working-memory) | 7.81 🙂 | 7.98 🙂 | 0.17 👎 |
| **[Quality](https://docs.sourcery.ai/GitHub/Quality-Report/#quality-score)** | **80.60%** ⭐| **80.06%** ⭐| **-0.54%** 👎 |

| Other metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| Lines | 803 | 862 | 59 |

| Changed files | Quality Before | Quality After | Quality Change |
| --- | :---: | :---: | :---: |
| particula/environment.py | 87.31% ⭐ | 86.99% ⭐ | -0.32% 👎|
| particula/particle.py | 75.18% ⭐ | 75.20% ⭐ | 0.02% 👍|
| particula/tests/environment_test.py | 92.06% ⭐ | 89.95% ⭐ | -2.11% 👎|
| particula/util/dynamic_viscosity.py | 83.67% ⭐ | 72.54% 🙂 | -11.13% 👎|
| particula/util/input_handling.py | 87.68% ⭐ | 87.95% ⭐ | 0.27% 👍|
| particula/util/mean_free_path.py | 69.96% 🙂 | 63.10% 🙂 | -6.86% 👎|

Here are some functions in these files that still need a tune-up:

| File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
| --- | --- | :---: | :---: | :---: | :---: | --- |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_parameterized | 6 ⭐ | 229 ⛔ | 16 ⛔ | 41.51% 😞 | Try splitting into smaller methods. Extract out complex expressions |
| particula/util/mean_free_path.py | mfp | 2 ⭐ | 81 🙂 | 14 😞 | 63.10% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_hard\_sphere | 0 ⭐ | 90 🙂 | 13 😞 | 65.20% 🙂 | Extract out complex expressions |
| particula/util/input_handling.py | in\_handling | 5 ⭐ | 54 ⭐ | 12 😞 | 67.26% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensioned\_coagulation\_kernel | 0 ⭐ | 67 🙂 | 13 😞 | 68.61% 🙂 | Extract out complex expressions |

## Legend and Explanation

The emojis denote the absolute quality of the code:

 - ⭐ excellent
 - 🙂 good
 - 😞 poor
 - ⛔ very poor


The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.

***

Please see our documentation [here](https://docs.sourcery.ai/GitHub/Quality-Report/) for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us [improve](https://research.typeform.com/to/j06Spdfr?type=quality_report&github_login=ngam&base_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&base_remote_ref=refs%2Fpull%2F167%2Fhead&base_ref=main&base_sha=4961f13df2506375ca4c25e494c019ad0042ad35&head_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&head_ref=sourcery%2Fpull-167&base_pr_number=167&base_pr_state=open) this quality report!
sourcery-ai[bot]: # Sourcery Code Quality Report

❌ &nbsp;Merging this PR will **decrease** code quality in the affected files by **0.54%**.

| Quality metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| [Complexity](https://docs.sourcery.ai/GitHub/Quality-Report/#complexity) | 1.16 ⭐ | 1.27 ⭐ | 0.11 👎 |
| [Method Length](https://docs.sourcery.ai/GitHub/Quality-Report/#method-length) | 31.65 ⭐ | 32.67 ⭐ | 1.02 👎 |
| [Working memory](https://docs.sourcery.ai/GitHub/Quality-Report/#working-memory) | 7.81 🙂 | 7.98 🙂 | 0.17 👎 |
| **[Quality](https://docs.sourcery.ai/GitHub/Quality-Report/#quality-score)** | **80.60%** ⭐| **80.06%** ⭐| **-0.54%** 👎 |

| Other metrics | Before | After | Change |
| --- | :---: | :---: | :---: |
| Lines | 803 | 862 | 59 |

| Changed files | Quality Before | Quality After | Quality Change |
| --- | :---: | :---: | :---: |
| particula/environment.py | 87.31% ⭐ | 86.99% ⭐ | -0.32% 👎|
| particula/particle.py | 75.18% ⭐ | 75.20% ⭐ | 0.02% 👍|
| particula/tests/environment_test.py | 92.06% ⭐ | 89.95% ⭐ | -2.11% 👎|
| particula/util/dynamic_viscosity.py | 83.67% ⭐ | 72.54% 🙂 | -11.13% 👎|
| particula/util/input_handling.py | 87.68% ⭐ | 87.95% ⭐ | 0.27% 👍|
| particula/util/mean_free_path.py | 69.96% 🙂 | 63.10% 🙂 | -6.86% 👎|

Here are some functions in these files that still need a tune-up:

| File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
| --- | --- | :---: | :---: | :---: | :---: | --- |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_parameterized | 6 ⭐ | 229 ⛔ | 16 ⛔ | 41.51% 😞 | Try splitting into smaller methods. Extract out complex expressions |
| particula/util/mean_free_path.py | mfp | 2 ⭐ | 81 🙂 | 14 😞 | 63.10% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensionless\_coagulation\_kernel\_hard\_sphere | 0 ⭐ | 90 🙂 | 13 😞 | 65.20% 🙂 | Extract out complex expressions |
| particula/util/input_handling.py | in\_handling | 5 ⭐ | 54 ⭐ | 12 😞 | 67.26% 🙂 | Extract out complex expressions |
| particula/particle.py | Particle.dimensioned\_coagulation\_kernel | 0 ⭐ | 67 🙂 | 13 😞 | 68.61% 🙂 | Extract out complex expressions |

## Legend and Explanation

The emojis denote the absolute quality of the code:

 - ⭐ excellent
 - 🙂 good
 - 😞 poor
 - ⛔ very poor


The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.

***

Please see our documentation [here](https://docs.sourcery.ai/GitHub/Quality-Report/) for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us [improve](https://research.typeform.com/to/j06Spdfr?type=quality_report&github_login=ngam&base_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&base_remote_ref=refs%2Fpull%2F167%2Fhead&base_ref=main&base_sha=890a3c09731f47b80f28f611038e6ea83f5be31f&head_repo=https%3A%2F%2Fgithub.com%2Funcscode%2Fparticula.git&head_ref=sourcery%2Fpull-167&base_pr_number=167&base_pr_state=open) this quality report!

Patch:
diff --git a/particula/environment.py b/particula/environment.py
index e2336b9b2..279d9ebc5 100644
--- a/particula/environment.py
+++ b/particula/environment.py
@@ -1,71 +1,94 @@
-"""environment class
-"""
+""" defining the environment class
 
-import numpy as np
+    kwargs:
+        temperature             (float) [K]      (default: 298.15)
+        pressure                (float) [Pa]     (default: 101325)
+      # dynamic_viscosity       (float) [Pa*s]   (default: util)
+      $ molecular_weight        (float) [kg/mol] (default: constants)
+      $ reference_viscosity     (float) [Pa*s]   (default: constants)
+      $ reference_temperature   (float) [K]      (default: constants)
+      $ sutherland_constant     (float) [K]      (default: constants)
+      $ gas_constant            (float) [J/mol/K](default: constants)
 
-from particula import u
-from particula.constants import GAS_CONSTANT
+      Using particula.util:
+        dynamic_viscosity       (float) [Pa*s]
 
+      Using particula.constants:
+        GAS_CONSTANT            (float) [J/mol/K]
+        MOLECULAR_WEIGHT_AIR    (float) [kg/mol]
+        REF_VISCOSITY_AIR_STP   (float) [Pa*s]
+        REF_TEMPERATURE_STP     (float) [K]
+        SUTHERLAND_CONSTANT     (float) [K]
 
-class Environment:
-    """
-    Sets the environment class
-    with properties such as temperature and pressure
-    and derived properties such as air viscosity.
-    """
+    Notes:
+      # stands for an optional util override
+      $ stands for an optional constants override
 
-    def __init__(self, temperature, pressure):
-        """Function calls for enviornment class."""
-        self._temperature = temperature
-        self._pressure = pressure
+"""
 
-    @u.wraps(u.K, [None])
-    def temperature(self) -> float:
-        """Returns the temperature of the environment."""
-        return self._temperature
+from particula.constants import (GAS_CONSTANT, MOLECULAR_WEIGHT_AIR,
+                                 REF_TEMPERATURE_STP, REF_VISCOSITY_AIR_STP,
+                                 SUTHERLAND_CONSTANT)
+from particula.util.dynamic_viscosity import dyn_vis
+from particula.util.input_handling import (in_gas_constant,
+                                           in_molecular_weight, in_pressure,
+                                           in_temperature, in_viscosity)
+from particula.util.mean_free_path import mfp
 
-    @u.wraps(u.Pa, [None])
-    def pressure(self) -> float:
-        """Returns the pressure of the environment."""
-        return self._pressure
 
-    @u.wraps(u.kg / u.m / u.s, [None])
-    def dynamic_viscosity_air(self) -> float:
-        """Returns the dynamic viscosity of air. [kg/m/s]
+class Environment:  # pylint: disable=too-many-instance-attributes
+    """ creating the environment class
 
-        The dynamic viscosity is calculated using the 3 parameter
-        Sutherland Viscosity Law.
+        For now, the environment class takes properties such as
+        temperature and pressure to calculate derived properties
+        such as viscosity and mean free path.
+    """
+
+    def __init__(self, **kwargs):
+        """ Initiate the environment class with base attrs.
         """
-        mu_ref = 1.716e-5 * u.Pa * u.s  # Viscosity at T_REF
-        t_ref = 273.15 * u.K
-        suth_const = 110.4 * u.K  # Sutherland constant
 
-        return (
-            mu_ref *
-            (self.temperature()/t_ref)**(3/2) *
-            (t_ref + suth_const) / (self.temperature() + suth_const)
+        self.temperature = in_temperature(
+            kwargs.get("temperature", 298.15)
+        )
+        self.reference_viscosity = in_viscosity(
+            kwargs.get("reference_viscosity", REF_VISCOSITY_AIR_STP)
+        )
+        self.reference_temperature = in_temperature(
+            kwargs.get("reference_temperature", REF_TEMPERATURE_STP)
+        )
+        self.pressure = in_pressure(
+            kwargs.get("pressure", 101325)
+        )
+        self.molecular_weight = in_molecular_weight(
+            kwargs.get("molecular_weight", MOLECULAR_WEIGHT_AIR)
+        )
+        self.sutherland_constant = in_temperature(
+            kwargs.get("sutherland_constant", SUTHERLAND_CONSTANT)
+        )
+        self.gas_constant = in_gas_constant(
+            kwargs.get("gas_constant", GAS_CONSTANT)
         )
 
-    # mean free path of air in m
-    @u.wraps(u.m, [None])
-    def mean_free_path_air(self) -> float:
-        """Returns the mean free path of this environment. [m]
+        self.kwargs = kwargs
 
-        The mean free path is the average distance traveled by a molecule
-        between collisions with other molecules.
+    def dynamic_viscosity(self):
+        """ Returns the dynamic viscosity in Pa*s.
         """
-        # Molecular weight of air in kg/mol
-        molecular_weight = (28.9644 * u.g / u.mol).to_base_units()
+        return dyn_vis(
+            temperature=self.temperature,
+            reference_viscosity=self.reference_viscosity,
+            reference_temperature=self.reference_temperature,
+            sutherland_constant=self.sutherland_constant,
+        )
 
-        return (
-            (
-                2 * self.dynamic_viscosity_air()
-                / self.pressure()
-                / (
-                    8*molecular_weight
-                    / (
-                        np.pi*GAS_CONSTANT*self.temperature()
-                    )
-                )**0.5
-            ).to_base_units()
+    def mean_free_path(self):
+        """ Returns the mean free path in m.
+        """
+        return mfp(
+            temperature=self.temperature,
+            pressure=self.pressure,
+            molecular_weight=self.molecular_weight,
+            dynamic_viscosity=self.dynamic_viscosity(),
+            gas_constant=self.gas_constant,
         )
diff --git a/particula/particle.py b/particula/particle.py
index 6e5f4d0b5..94bd25183 100644
--- a/particula/particle.py
+++ b/particula/particle.py
@@ -120,7 +120,7 @@ class Particle:
         divided by the particle radius.
         """
 
-        return environment.mean_free_path_air() / self.radius()
+        return environment.mean_free_path() / self.radius()
 
     @u.wraps(u.dimensionless, [None, None])
     def slip_correction_factor(self, environment: Environment) -> float:
@@ -156,7 +156,7 @@ class Particle:
             environment
         )
         return (
-            6 * np.pi * environment.dynamic_viscosity_air() * self.radius() /
+            6 * np.pi * environment.dynamic_viscosity() * self.radius() /
             slip_correction_factor
         )
 
@@ -211,7 +211,7 @@ class Particle:
         )
         return (
             numerator /
-            (denominator * BOLTZMANN_CONSTANT * environment.temperature())
+            (denominator * BOLTZMANN_CONSTANT * environment.temperature)
         )
 
     @u.wraps(u.dimensionless, [None, None, None])
@@ -266,7 +266,7 @@ class Particle:
 
         numerator = (
             (
-                environment.temperature() * BOLTZMANN_CONSTANT
+                environment.temperature * BOLTZMANN_CONSTANT
                 * self.reduced_mass(other)
             )**0.5
             / self.reduced_friction_factor(other, environment)
diff --git a/particula/util/dynamic_viscosity.py b/particula/util/dynamic_viscosity.py
index 5bad3133b..669e6a086 100644
--- a/particula/util/dynamic_viscosity.py
+++ b/particula/util/dynamic_viscosity.py
@@ -12,13 +12,19 @@
         https://resources.wolframcloud.com/FormulaRepository/resources/Sutherlands-Formula
 
 """
-
+from particula import u
 from particula.constants import (REF_TEMPERATURE_STP, REF_VISCOSITY_AIR_STP,
                                  SUTHERLAND_CONSTANT)
 from particula.util.input_handling import in_temperature, in_viscosity
 
 
-def dyn_vis(**kwargs):
+def dyn_vis(
+    temperature=298.15 * u.K,
+    reference_viscosity=REF_VISCOSITY_AIR_STP,
+    reference_temperature=REF_TEMPERATURE_STP,
+    sutherland_constant=SUTHERLAND_CONSTANT,
+    **kwargs,
+):
     """ The dynamic viscosity of air via Sutherland formula.
         This formula depends on temperature (temp) and the reference
         temperature (t_ref) as well as the reference viscosity (mu_ref).
@@ -55,6 +61,7 @@ def dyn_vis(**kwargs):
             temperature             (float) [K]     (default: 298.15)
             reference_viscosity     (float) [Pa*s]  (default: constants)
             reference_temperature   (float) [K]     (default: constants)
+            sutherland_constant     (float) [K]     (default: constants)
 
         Returns:
                                     (float) [Pa*s]
@@ -65,18 +72,16 @@ def dyn_vis(**kwargs):
             SUTHERLAND_CONSTANT     (float) [K]
 
     """
-
-    temp = kwargs.get("temperature", 298.15)
-    ref_vis = kwargs.get("reference_viscosity", REF_VISCOSITY_AIR_STP)
-    ref_temp = kwargs.get("reference_temperature", REF_TEMPERATURE_STP)
-
-    temp = in_temperature(temp)
-    ref_vis = in_viscosity(ref_vis)
-    ref_temp = in_temperature(ref_temp)
-
-    suth_const = SUTHERLAND_CONSTANT
+    # trick to avoid triggering a linting error for kwargs
+    temp = kwargs.get("temperature", temperature)
+    temp = in_temperature(temperature)
+    ref_vis = in_viscosity(reference_viscosity)
+    ref_temp = in_temperature(reference_temperature)
+    suth_const = in_temperature(sutherland_constant)
 
     return (
-        ref_vis * (temp/ref_temp)**(3/2) * (ref_temp + suth_const) /
+        ref_vis *
+        (temp/ref_temp)**(3/2) *
+        (ref_temp + suth_const) /
         (temp + suth_const)
-    )
+    ).to_base_units()
diff --git a/particula/util/input_handling.py b/particula/util/input_handling.py
index 4658d44f2..4f7fed6e6 100644
--- a/particula/util/input_handling.py
+++ b/particula/util/input_handling.py
@@ -87,3 +87,4 @@ def in_density(density): return in_handling(density, u.kg/u.m**3)
 def in_scalar(scalar): return in_handling(scalar, u.dimensionless)
 def in_length(length): return in_handling(length, u.m)
 def in_area(area): return in_handling(area, u.m**2)
+def in_gas_constant(con): return in_handling(con, u.J/u.K/u.mol)
diff --git a/particula/util/mean_free_path.py b/particula/util/mean_free_path.py
index 4efc979ce..13a8e9fb4 100644
--- a/particula/util/mean_free_path.py
+++ b/particula/util/mean_free_path.py
@@ -17,13 +17,22 @@
 """
 
 import numpy as np
+from particula import u
 from particula.constants import GAS_CONSTANT, MOLECULAR_WEIGHT_AIR
 from particula.util.dynamic_viscosity import dyn_vis
-from particula.util.input_handling import (in_molecular_weight, in_pressure,
+from particula.util.input_handling import (in_gas_constant,
+                                           in_molecular_weight, in_pressure,
                                            in_temperature, in_viscosity)
 
 
-def mfp(**kwargs):
+def mfp(
+    temperature=298.15*u.K,
+    pressure=101325*u.Pa,
+    molecular_weight=MOLECULAR_WEIGHT_AIR,
+    dynamic_viscosity=None,
+    gas_constant=GAS_CONSTANT,
+    **kwargs,
+):
     """ Returns the mean free path of in air.
 
         The mean free path is the average distance
@@ -100,17 +109,18 @@ def mfp(**kwargs):
             it overrides the calculated value.
     """
 
-    temp = kwargs.get("temperature", 298.15)
-    pres = kwargs.get("pressure", 101325)
-    molec_wt = kwargs.get("molecular_weight", MOLECULAR_WEIGHT_AIR)
-    dyn_vis_val = kwargs.get("dynamic_viscosity", dyn_vis(**kwargs))
+    temp = in_temperature(temperature)
+    pres = in_pressure(pressure)
+    molec_wt = in_molecular_weight(molecular_weight)
 
-    temp = in_temperature(temp)
-    pres = in_pressure(pres)
-    molec_wt = in_molecular_weight(molec_wt)
-    dyn_vis_val = in_viscosity(dyn_vis_val)
+    if dynamic_viscosity is None:
+        dyn_vis_val = in_viscosity(
+            dyn_vis(temperature=temp, **kwargs)
+        )
+    else:
+        dyn_vis_val = in_viscosity(dynamic_viscosity)
 
-    gas_con = GAS_CONSTANT
+    gas_con = in_gas_constant(gas_constant)
 
     return (
         (2 * dyn_vis_val / pres) /


Test patch:
diff --git a/particula/tests/environment_test.py b/particula/tests/environment_test.py
index 355e3a87d..9b5892b25 100644
--- a/particula/tests/environment_test.py
+++ b/particula/tests/environment_test.py
@@ -1,38 +1,58 @@
-"""tests for the environment module.
+""" testing the environment class.
 """
 
 import pytest
 from particula import environment, u
 
+inputs = {
+    "temperature": 298.15,
+    "pressure": 101325
+}
+inputs33 = {
+    "temperature": [298.15, 299, 300],
+    "pressure": [101325, 101330, 101335]
+}
 standard_environment = environment.Environment(
-    temperature=298,  # * u.K,
-    pressure=101325,  # * u.Pa,
+    **inputs
 )
 
 
 def test_getters():
+    """ Tests the getters for the Environment class.
     """
-    Tests the getters for the Environment class.
-    """
-    assert standard_environment.temperature() == 298 * u.K
-    assert standard_environment.pressure() == 101325 * u.Pa
+    assert standard_environment.temperature == inputs["temperature"] * u.K
+    assert standard_environment.pressure == inputs["pressure"] * u.Pa
 
 
 def test_dynamic_viscosity_air():
-    """
-    Tests that the calculation for the dynamic viscosity of air works.
+    """ Tests the dynamic viscosity.
     """
     assert (
-        standard_environment.dynamic_viscosity_air().magnitude ==
+        standard_environment.dynamic_viscosity().magnitude ==
         pytest.approx(1.716e-5, rel=1e-1)
     )
 
 
 def test_mean_free_path_air():
-    """
-    Test that the calculation for the mean free path of air works.
+    """ Test the mean free path.
     """
     assert (
-        standard_environment.mean_free_path_air().magnitude ==
+        standard_environment.mean_free_path().magnitude ==
         pytest.approx(6.644e-8, rel=1e-1)
     )
+
+
+def test_shapes():
+    """ testing the shapes, allowing list inputs
+    """
+
+    assert (
+        environment.Environment(**inputs33).pressure.m.shape
+        ==
+        (len(inputs33["pressure"]),)
+    )
+    assert (
+        environment.Environment(**inputs33).dynamic_viscosity().m.shape
+        ==
+        (len(inputs33["pressure"]),)
+    )