diff --git a/AUTHORS.md b/AUTHORS.md index 15f9254..8bc08bd 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,10 +1,10 @@ # Core Developer # ---------- -- Sepand Haghighi - Sharif University Of Technology/Moduland Co - [@sepandhaghighi](http://github.com/sepandhaghighi) -- Sadra Sabouri - Sharif University Of Technology - [@sadrasabouri](https://github.com/sadrasabouri) +- Sepand Haghighi - Sharif University of Technology - [@sepandhaghighi](http://github.com/sepandhaghighi) +- Sadra Sabouri - Sharif University of Technology - [@sadrasabouri](https://github.com/sadrasabouri) # Other Contributors # -- Mohammad Hosein Moslemi - Sharif University Of Technology - [@mhmoslemi2338](https://github.com/mhmoslemi2338) +- Mohammad Hosein Moslemi - [@mhmoslemi2338](https://github.com/mhmoslemi2338) - Evan Slack - [@evanofslack](https://github.com/evanofslack) ---------- \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e9a540c..a285a80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added - `__del__` method -- `alpha` attribute - Demo notebook ### Changed - `depth` parameter added to `nft_storage` method - `depth` parameter added to `save_fig_buf` function +- `alpha` parameter added to `plot` method +- `alpha` parameter added to `plot_params_filter` function - Random mode modified - `README.md` updated ## [0.4] - 2022-01-13 diff --git a/samila/functions.py b/samila/functions.py index c28ab18..480a36e 100644 --- a/samila/functions.py +++ b/samila/functions.py @@ -164,7 +164,7 @@ def plot_params_filter( :type size: tuple :param projection: projection type :type projection: str - :param alpha: point alpha + :param alpha: point transparency :type alpha: float :return: None """ @@ -308,7 +308,8 @@ def save_data_file(g, file_adr): "color": g.color, "bgcolor": g.bgcolor, "spot_size": g.spot_size, - "projection": g.projection + "projection": g.projection, + "alpha": g.alpha } data['matplotlib_version'] = matplotlib_version result = {"status": True, "message": DATA_SAVE_SUCCESS_MESSAGE} @@ -347,7 +348,8 @@ def save_config_file(g, file_adr): "color": g.color, "bgcolor": g.bgcolor, "spot_size": g.spot_size, - "projection": g.projection + "projection": g.projection, + "alpha": g.alpha } data['matplotlib_version'] = matplotlib_version result = {"status": True, "message": DATA_SAVE_SUCCESS_MESSAGE} @@ -378,7 +380,7 @@ def save_fig_file(figure, file_adr, depth): try: figure.savefig( file_adr, - dpi=depth*figure.dpi, + dpi=depth * figure.dpi, facecolor=figure.get_facecolor(), edgecolor='none') return result @@ -408,7 +410,7 @@ def save_fig_buf(figure, depth): buf = io.BytesIO() figure.savefig( buf, - dpi=depth*figure.dpi, + dpi=depth * figure.dpi, format='png', facecolor=figure.get_facecolor(), edgecolor='none') @@ -468,6 +470,7 @@ def load_data(g, data): g.bgcolor = plot_config.get("bgcolor", DEFAULT_BACKGROUND_COLOR) g.spot_size = plot_config.get("spot_size", DEFAULT_SPOT_SIZE) g.projection = plot_config.get("projection", DEFAULT_PROJECTION) + g.alpha = plot_config.get("alpha", DEFAULT_ALPHA) return raise samilaDataError(DATA_TYPE_ERROR) @@ -500,5 +503,6 @@ def load_config(g, config): g.bgcolor = plot_config.get("bgcolor", DEFAULT_BACKGROUND_COLOR) g.spot_size = plot_config.get("spot_size", DEFAULT_SPOT_SIZE) g.projection = plot_config.get("projection", DEFAULT_PROJECTION) + g.alpha = plot_config.get("alpha", DEFAULT_ALPHA) return raise samilaConfigError(CONFIG_TYPE_ERROR) diff --git a/samila/genimage.py b/samila/genimage.py index b35a69b..1d92d44 100644 --- a/samila/genimage.py +++ b/samila/genimage.py @@ -106,9 +106,18 @@ class GenerativeImage: :type size: tuple :param projection: projection type :type projection: str + :param alpha: point transparency + :type alpha: float :return: None """ - plot_params_filter(self, color, bgcolor, spot_size, size, projection, alpha) + plot_params_filter( + self, + color, + bgcolor, + spot_size, + size, + projection, + alpha) fig = plt.figure() fig.set_size_inches(self.size[0], self.size[1]) fig.set_facecolor(self.bgcolor) diff --git a/test/overall_test.py b/test/overall_test.py index 337361d..23fdbf9 100644 --- a/test/overall_test.py +++ b/test/overall_test.py @@ -161,6 +161,9 @@ False [0] >>> g.data2 [1] +>>> g_ = GenerativeImage() +>>> del(g) +>>> del(g_) >>> os.remove("test.png") >>> os.remove("test2.png") >>> os.remove("data.json")