samila/samila/params.py

79 wiersze
2.2 KiB
Python
Czysty Zwykły widok Historia

2021-09-20 19:58:52 +00:00
# -*- coding: utf-8 -*-
"""Samila params."""
2021-09-26 20:40:20 +00:00
import math
2021-09-28 11:46:15 +00:00
from enum import Enum
from matplotlib import colors as mcolors
2021-09-26 20:40:20 +00:00
2021-11-09 13:49:04 +00:00
SAMILA_VERSION = "0.3" # pragma: no cover
2021-09-29 15:32:44 +00:00
2021-10-05 09:59:53 +00:00
OVERVIEW = '''
Samila is a generative art generator written in Python, Samila let's you
create arts based on many thousand points. The position of every single
point is calculated by a formula, which has random parameters.
Because of the random numbers, every image looks different.
'''
2021-09-26 20:40:20 +00:00
DEFAULT_START = -1 * math.pi
DEFAULT_STOP = math.pi
DEFAULT_STEP = 0.01
DEFAULT_COLOR = "black"
2021-09-28 06:21:31 +00:00
DEFAULT_BACKGROUND_COLOR = "white"
DEFAULT_ALPHA = 0.1
2021-09-27 07:18:06 +00:00
DEFAULT_IMAGE_SIZE = (10, 10)
2021-09-26 20:40:20 +00:00
DEFAULT_SPOT_SIZE = 0.01
DEFAULT_PROJECTION = None
VALID_COLORS = list(dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS).keys())
NFT_STORAGE_API = "https://api.nft.storage/upload"
NFT_STORAGE_SUCCESS_MESSAGE = "Everything seems good."
2021-10-12 12:50:50 +00:00
FIG_SAVE_SUCCESS_MESSAGE = "Everything seems good."
2021-10-22 09:28:52 +00:00
DATA_SAVE_SUCCESS_MESSAGE = "Everything seems good."
NO_FIG_ERROR_MESSAGE = "No figure was found. First run `generate` and `plot` methods."
2021-10-22 09:19:40 +00:00
DATA_TYPE_ERROR = "Provided data file is not supported. It should be either file or io.IOBase."
DATA_PARSING_ERROR = "Provided data format is wrong. It should be in JSON format including data1 and data2 fields."
2021-10-22 10:19:21 +00:00
NO_FUNCTION_ERROR = "At least one of the given functions are None."
2021-10-23 17:13:42 +00:00
JUST_DATA_WARNING = "Just data is provided, generate method is not available in this mode."
MATPLOTLIB_VERSION_WARNING = "Source matplotlib version({0}) is different from yours, plots may be different."
2021-10-22 10:19:21 +00:00
2021-09-28 11:46:15 +00:00
class Projection(Enum):
2021-09-29 05:50:46 +00:00
"""
Samila Projection type class.
>>> projection = samila.Projection.POLAR
"""
2021-09-28 11:46:15 +00:00
DEFAULT = DEFAULT_PROJECTION
POLAR = "polar"
AITOFF = "aitoff"
HAMMER = "hammer"
LAMBERT = "lambert"
MOLLWEIDE = "mollweide"
2021-09-28 12:57:57 +00:00
RECTILINEAR = "rectilinear"
2021-12-14 15:13:34 +00:00
2021-12-18 19:08:31 +00:00
ELEMENTS_LIST = [
"{0}*math.cos({1})",
"{0}*math.sin({1})",
"{0}*{1}",
"{0}*abs({1})",
"{0}*math.ceil({1})",
"{0}*math.floor({1})"]
2021-12-14 15:13:34 +00:00
2021-12-18 19:08:31 +00:00
ARGUMENTS_LIST = [
"x*y",
"x",
"y",
"y-x",
"x-y",
"x+y",
"x**2",
"y**2",
"(x**2)*y",
"(y**2)*x",
"(x**2)*(y**3)",
"(x**3)*(y**2)",
"x*(y**3)",
"y*(x**3)"]
2021-12-14 15:13:34 +00:00
2021-12-18 19:08:31 +00:00
OPERATORS_LIST = ["+", "-"]