scatterscale 0.0.1__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.
File without changes
@@ -0,0 +1,46 @@
1
+ import numpy as np
2
+
3
+ def handle_outliers(dist, sigma_value=10, treatment='reassign'):
4
+ """
5
+ Function to identify and handle outlier values in the distribution,
6
+ which would drastically change the scaling of the colorbar if not addressed.
7
+
8
+ Inputs
9
+ -------
10
+ dist: 1d float array
11
+ data to be represented by the colorbar.
12
+ sigma_value: int, default 10
13
+ number of stddev to use when identifying outliers, if using the sigma method.
14
+ treatment: str, default='reassign'
15
+ how to treat the identified outliers. options are 'reassign' and 'mask_out'.
16
+
17
+ Outputs
18
+ -------
19
+ modified_dist: 1d float array
20
+ data to be represented by the colorbar, treated for outliers according to the specifications.
21
+ """
22
+
23
+ median = np.median(dist)
24
+ # center the gaussian at the median of the distribution
25
+ stddev = np.std(dist, mean=median)
26
+
27
+ lower_bound = median - sigma_value * stddev
28
+ upper_bound = median + sigma_value * stddev
29
+
30
+ upper_outliers = dist > upper_bound
31
+ lower_outliers = dist < lower_bound
32
+
33
+ # choose the method to treat outliers
34
+
35
+ if treatment == 'reassign':
36
+
37
+ # make a deep copy
38
+ dist_modified = np.copy(dist)
39
+ dist_modified[upper_outliers] = upper_bound
40
+ dist_modified[lower_outliers] = lower_bound
41
+
42
+ elif treatment == 'mask_out':
43
+
44
+ dist_modified = dist[~upper_outliers & ~lower_outliers]
45
+
46
+ return dist_modified
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: scatterscale
3
+ Version: 0.0.1
4
+ Summary: Automatically determine the best scaling for your scatterplot's colorbar.
5
+ Author-email: Juliana Karp <jsmkarp@uw.edu>, Anavi Uppal <anuppal@ucsc.edu>
6
+ Maintainer-email: Juliana Karp <jsmkarp@uw.edu>, Anavi Uppal <anuppal@ucsc.edu>
7
+ License-Expression: MIT
8
+ Project-URL: Repository, https://github.com/juliana-karp/scatterscale.git
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: numpy
12
+ Requires-Dist: matplotlib
13
+ Requires-Dist: scipy
14
+ Requires-Dist: pandas
15
+
16
+ # scatterscale
17
+ automate the choice of normalizing scale for your scatterplot's colorbar
@@ -0,0 +1,6 @@
1
+ scatterscale/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ scatterscale/outliers.py,sha256=u6tam5lOeI_tfFk5YEBFFqOraMrkGW-wgVCJlcnWkXM,1447
3
+ scatterscale-0.0.1.dist-info/METADATA,sha256=zXSIuO32-MCR5sS1vnhtL11hDTKJS5QUpmtkzHpvcAM,635
4
+ scatterscale-0.0.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
5
+ scatterscale-0.0.1.dist-info/top_level.txt,sha256=3DR_g-n3eVBuJNQCL-Rr1zzGGNuPn0qNOuD2_jzEOTA,13
6
+ scatterscale-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ scatterscale