kopia lustrzana https://github.com/sepandhaghighi/samila
Minor edits (#98)
* fix : alpha added to save_config and save_data * fix : alpha added to load_config and load_data * doc : docstring updated * doc : CHANGELOG updated * fix : autopep8 * doc : AUTHORS.md updated * fix : overall_test.py updated * doc : AUTHORS.md updatedpull/102/head
rodzic
fed58e0ee3
commit
5d3a0a11bb
|
@ -1,10 +1,10 @@
|
||||||
# Core Developer #
|
# Core Developer #
|
||||||
|
|
||||||
----------
|
----------
|
||||||
- Sepand Haghighi - Sharif University Of Technology/Moduland Co - [@sepandhaghighi](http://github.com/sepandhaghighi)
|
- Sepand Haghighi - Sharif University of Technology - [@sepandhaghighi](http://github.com/sepandhaghighi)
|
||||||
- Sadra Sabouri - Sharif University Of Technology - [@sadrasabouri](https://github.com/sadrasabouri)
|
- Sadra Sabouri - Sharif University of Technology - [@sadrasabouri](https://github.com/sadrasabouri)
|
||||||
|
|
||||||
# Other Contributors #
|
# 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)
|
- Evan Slack - [@evanofslack](https://github.com/evanofslack)
|
||||||
----------
|
----------
|
|
@ -7,11 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
- `__del__` method
|
- `__del__` method
|
||||||
- `alpha` attribute
|
|
||||||
- Demo notebook
|
- Demo notebook
|
||||||
### Changed
|
### Changed
|
||||||
- `depth` parameter added to `nft_storage` method
|
- `depth` parameter added to `nft_storage` method
|
||||||
- `depth` parameter added to `save_fig_buf` function
|
- `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
|
- Random mode modified
|
||||||
- `README.md` updated
|
- `README.md` updated
|
||||||
## [0.4] - 2022-01-13
|
## [0.4] - 2022-01-13
|
||||||
|
|
|
@ -164,7 +164,7 @@ def plot_params_filter(
|
||||||
:type size: tuple
|
:type size: tuple
|
||||||
:param projection: projection type
|
:param projection: projection type
|
||||||
:type projection: str
|
:type projection: str
|
||||||
:param alpha: point alpha
|
:param alpha: point transparency
|
||||||
:type alpha: float
|
:type alpha: float
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
@ -308,7 +308,8 @@ def save_data_file(g, file_adr):
|
||||||
"color": g.color,
|
"color": g.color,
|
||||||
"bgcolor": g.bgcolor,
|
"bgcolor": g.bgcolor,
|
||||||
"spot_size": g.spot_size,
|
"spot_size": g.spot_size,
|
||||||
"projection": g.projection
|
"projection": g.projection,
|
||||||
|
"alpha": g.alpha
|
||||||
}
|
}
|
||||||
data['matplotlib_version'] = matplotlib_version
|
data['matplotlib_version'] = matplotlib_version
|
||||||
result = {"status": True, "message": DATA_SAVE_SUCCESS_MESSAGE}
|
result = {"status": True, "message": DATA_SAVE_SUCCESS_MESSAGE}
|
||||||
|
@ -347,7 +348,8 @@ def save_config_file(g, file_adr):
|
||||||
"color": g.color,
|
"color": g.color,
|
||||||
"bgcolor": g.bgcolor,
|
"bgcolor": g.bgcolor,
|
||||||
"spot_size": g.spot_size,
|
"spot_size": g.spot_size,
|
||||||
"projection": g.projection
|
"projection": g.projection,
|
||||||
|
"alpha": g.alpha
|
||||||
}
|
}
|
||||||
data['matplotlib_version'] = matplotlib_version
|
data['matplotlib_version'] = matplotlib_version
|
||||||
result = {"status": True, "message": DATA_SAVE_SUCCESS_MESSAGE}
|
result = {"status": True, "message": DATA_SAVE_SUCCESS_MESSAGE}
|
||||||
|
@ -378,7 +380,7 @@ def save_fig_file(figure, file_adr, depth):
|
||||||
try:
|
try:
|
||||||
figure.savefig(
|
figure.savefig(
|
||||||
file_adr,
|
file_adr,
|
||||||
dpi=depth*figure.dpi,
|
dpi=depth * figure.dpi,
|
||||||
facecolor=figure.get_facecolor(),
|
facecolor=figure.get_facecolor(),
|
||||||
edgecolor='none')
|
edgecolor='none')
|
||||||
return result
|
return result
|
||||||
|
@ -408,7 +410,7 @@ def save_fig_buf(figure, depth):
|
||||||
buf = io.BytesIO()
|
buf = io.BytesIO()
|
||||||
figure.savefig(
|
figure.savefig(
|
||||||
buf,
|
buf,
|
||||||
dpi=depth*figure.dpi,
|
dpi=depth * figure.dpi,
|
||||||
format='png',
|
format='png',
|
||||||
facecolor=figure.get_facecolor(),
|
facecolor=figure.get_facecolor(),
|
||||||
edgecolor='none')
|
edgecolor='none')
|
||||||
|
@ -468,6 +470,7 @@ def load_data(g, data):
|
||||||
g.bgcolor = plot_config.get("bgcolor", DEFAULT_BACKGROUND_COLOR)
|
g.bgcolor = plot_config.get("bgcolor", DEFAULT_BACKGROUND_COLOR)
|
||||||
g.spot_size = plot_config.get("spot_size", DEFAULT_SPOT_SIZE)
|
g.spot_size = plot_config.get("spot_size", DEFAULT_SPOT_SIZE)
|
||||||
g.projection = plot_config.get("projection", DEFAULT_PROJECTION)
|
g.projection = plot_config.get("projection", DEFAULT_PROJECTION)
|
||||||
|
g.alpha = plot_config.get("alpha", DEFAULT_ALPHA)
|
||||||
return
|
return
|
||||||
raise samilaDataError(DATA_TYPE_ERROR)
|
raise samilaDataError(DATA_TYPE_ERROR)
|
||||||
|
|
||||||
|
@ -500,5 +503,6 @@ def load_config(g, config):
|
||||||
g.bgcolor = plot_config.get("bgcolor", DEFAULT_BACKGROUND_COLOR)
|
g.bgcolor = plot_config.get("bgcolor", DEFAULT_BACKGROUND_COLOR)
|
||||||
g.spot_size = plot_config.get("spot_size", DEFAULT_SPOT_SIZE)
|
g.spot_size = plot_config.get("spot_size", DEFAULT_SPOT_SIZE)
|
||||||
g.projection = plot_config.get("projection", DEFAULT_PROJECTION)
|
g.projection = plot_config.get("projection", DEFAULT_PROJECTION)
|
||||||
|
g.alpha = plot_config.get("alpha", DEFAULT_ALPHA)
|
||||||
return
|
return
|
||||||
raise samilaConfigError(CONFIG_TYPE_ERROR)
|
raise samilaConfigError(CONFIG_TYPE_ERROR)
|
||||||
|
|
|
@ -106,9 +106,18 @@ class GenerativeImage:
|
||||||
:type size: tuple
|
:type size: tuple
|
||||||
:param projection: projection type
|
:param projection: projection type
|
||||||
:type projection: str
|
:type projection: str
|
||||||
|
:param alpha: point transparency
|
||||||
|
:type alpha: float
|
||||||
:return: None
|
: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 = plt.figure()
|
||||||
fig.set_size_inches(self.size[0], self.size[1])
|
fig.set_size_inches(self.size[0], self.size[1])
|
||||||
fig.set_facecolor(self.bgcolor)
|
fig.set_facecolor(self.bgcolor)
|
||||||
|
|
|
@ -161,6 +161,9 @@ False
|
||||||
[0]
|
[0]
|
||||||
>>> g.data2
|
>>> g.data2
|
||||||
[1]
|
[1]
|
||||||
|
>>> g_ = GenerativeImage()
|
||||||
|
>>> del(g)
|
||||||
|
>>> del(g_)
|
||||||
>>> os.remove("test.png")
|
>>> os.remove("test.png")
|
||||||
>>> os.remove("test2.png")
|
>>> os.remove("test2.png")
|
||||||
>>> os.remove("data.json")
|
>>> os.remove("data.json")
|
||||||
|
|
Ładowanie…
Reference in New Issue