Package: samila
SamilaTable of contentsOverviewInstallationUsageMathematical DetailsTry Samila in Your BrowserIssues & Bug ReportsSocial MediaContributionReferencesAcknowledgmentsAuthorsLicenseShow Your SupportChangelogCode of ConductOverviewSamila is a generative art generator written in Python, Samila lets you create images 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.Open HubPyPI CounterGithub StarsBranchmasterdevCICode QualityInstallationSource codeDownloadVersion 1.1orLatest SourceRunpip install -r requirements.txtorpip3 install -r requirements.txt(Need root access)Runpython3 setup.py installorpython setup.py install(Need root access)PyPICheckPython Packaging User GuideRunpip install samila==1.1orpip3 install samila==1.1(Need root access)Easy installRuneasy_install --upgrade samila(Need root access)CondaCheckConda Managing Packageconda install -c sepandhaghighi samila(Need root access)UsageMagic>>>importmatplotlib.pyplotasplt>>>fromsamilaimportGenerativeImage>>>g=GenerativeImage()>>>g.generate()>>>g.plot()>>>plt.show()Basic>>>importrandom>>>importmath>>>deff1(x,y):result = random.uniform(-1,1) * x**2  - math.sin(y**2) + abs(y-x)return result>>>deff2(x,y):result = random.uniform(-1,1) * y**3 - math.cos(x**2) + 2*xreturn result>>>g=GenerativeImage(f1,f2)>>>g.generate()>>>g.plot()>>>g.seed188781>>>plt.show()Projection>>>fromsamilaimportProjection>>>g=GenerativeImage(f1,f2)>>>g.generate()>>>g.plot(projection=Projection.POLAR)>>>g.seed829730>>>plt.show()Supported projections :RECTILINEAR,POLAR,AITOFF,HAMMER,LAMBERT,MOLLWEIDEandRANDOMDefault projection isRECTILINEARMarker>>>fromsamilaimportMarker>>>g=GenerativeImage(f1,f2)>>>g.generate()>>>g.plot(marker=Marker.CIRCLE,spot_size=10)>>>g.seed448742>>>plt.show()Supported markers :POINT,PIXEL,CIRCLE,TRIANGLE_DOWN,TRIANGLE_UP,TRIANGLE_LEFT,TRIANGLE_RIGHT,TRI_DOWN,TRI_UP,TRI_LEFT,TRI_RIGHT,OCTAGON,SQUARE,PENTAGON,PLUS,PLUS_FILLED,STAR,HEXAGON_VERTICAL,HEXAGON_HORIZONTAL,X,X_FILLED,DIAMOND,DIAMON_THIN,VLINE,HLINEandRANDOMDefault marker isPOINTRotationYou can even rotate your art by usingrotationparameter. Enter your desired rotation for the image in degrees and you will have it.>>>g=GenerativeImage(f1,f2)>>>g.generate()>>>g.plot(rotation=45)Default rotation is 0Range>>>g=GenerativeImage(f1,f2)>>>g.generate(start=-2*math.pi,step=0.01,stop=0)>>>g.plot()>>>g.seed234752>>>plt.show()Color>>>g=GenerativeImage(f1,f2)>>>g.generate()>>>g.plot(color="yellow",bgcolor="black",projection=Projection.POLAR)>>>g.seed1018273>>>plt.show()Supported colors are available inVALID_COLORSlistcolorandbgcolorparameters supported formats:Color name (example:color="yellow")RGB/RGBA (example:color=(0.1,0.1,0.1),color=(0.1,0.1,0.1,0.1))Hex (example:color="#eeefff")Random (example:color="random")Complement (example:color="complement", bgcolor="blue")Transparent (example:bgcolor="transparent")List (example:color=["black", "#fffeef",...])⚠️Transparentmode is only available for background⚠️Listmode is only available for color⚠️ InListmode, the length of this list must be equal to the lengths of data1 and data2Point ColorYou can make your custom color map and use it in Samila>>>colorarray=[...[0.7,0.2,0.2,1],...[0.6,0.3,0.2,1],..."black",...[0.4,0.4,0.3,1],...[0.3,0.4,0.4,1],..."#ff2561"]>>>g.generate()>>>g.seed454893>>>g.plot(cmap=colorarray,color=g.data2,projection=Projection.POLAR)>>>plt.show()Regeneration>>>g=GenerativeImage(f1,f2)>>>g.generate(seed=1018273)>>>g.plot(projection=Projection.POLAR)>>>plt.show()NFT.storageUpload generated image directly toNFT.storage>>>g.nft_storage(api_key="YOUR_API_KEY",timeout=5000){'status': True, 'message': 'FILE_LINK'}You can also upload your config/data to nft storage as follows:>>>g.nft_storage(api_key="API_KEY",upload_config=True){'status': {'image': True, 'config':True}, 'message': {'image':'IMAGE_FILE_LINK', 'config':'CONFIG_FILE_LINK'}or>>>g.nft_storage(api_key="API_KEY",upload_data=True){'status': {'image': True, 'data':True}, 'message': {'image':'IMAGE_FILE_LINK', 'data':'DATA_FILE_LINK'}Default timeout is3000secondsSave imageSave generated image>>>g.save_image(file_adr="test.png"){'status': True, 'message': 'FILE_PATH'}Save generated image in higher resolutions>>>g.save_image(file_adr="test.png",depth=5){'status': True, 'message': 'FILE_PATH'}Save dataSave generated image data>>>g.save_data(file_adr="data.json"){'status': True, 'message': 'FILE_PATH'}So you can load it into aGenerativeImageinstance later by>>>g=GenerativeImage(data=open('data.json','r'))Data structure:{"plot":{"projection":"polar","bgcolor":"black","color":"snow","spot_size":0.01},"matplotlib_version":"3.0.3","data1":[0.3886741692042526,22.57390286376703,-0.1646310981668766,66.23632344600155],"data2":[-0.14588750183600108,20.197945942677833,0.5485453260942901,-589.3284610518896]}Save configSave generated image config. It contains string formats of functions which is also human readable.>>>g.save_config(file_adr="config.json"){'status': True, 'message': 'FILE_PATH'}So you can load it into aGenerativeImageinstance later by>>>g=GenerativeImage(config=open('config.json','r'))Config structure:{"matplotlib_version":"3.0.3","generate":{"seed":379184,"stop":3.141592653589793,"step":0.01,"start":-3.141592653589793},"f2":"random.uniform(-1,1)*math.cos(x*(y**3))+random.uniform(-1,1)*math.ceil(y-x)","f1":"random.uniform(-1,1)*math.ceil(y)-random.uniform(-1,1)*y**2+random.uniform(-1,1)*abs(y-x)","plot":{"color":"snow","bgcolor":"black","projection":"polar","spot_size":0.01}}Mathematical detailsSamila is simply a transformation between a square-shaped space from the Cartesian coordinate system to any arbitrary coordination likePolar coordinate system.ExampleWe have set of points in the first space (left square) which can be defined as follow:And below functions are used for transformation:>>>deff1(x,y):result = random.uniform(-1,1) * x**2 - math.sin(y**2) + abs(y-x)return result>>>deff2(x,y):result = random.uniform(-1,1) * y**3 - math.cos(x**2) + 2*xreturn resulthere we useProjection.POLARso later space will be the polar space and we have:>>>g=GenerativeImage(f1,f2)>>>g.generate(seed=10)>>>g.plot(projection=Projection.POLAR)Try Samila in your browser!Samila can be used online in interactive Jupyter Notebooks via the Binder or Colab services! Try it out now! :CheckexamplesfolderIssues & bug reportsJust fill an issue and describe it. We'll check it ASAP! or send an email toinfo@samila.site.Please complete the issue templateYou can also join our discord serverSocial mediaInstagramTelegramTwitterDiscordReferences1- Schönlieb, Carola-Bibiane, and Franz Schubert. "Random simulations for generative art construction–some examples." Journal of Mathematics and the Arts 7.1 (2013): 29-39.2-Create Generative Art with R3-NFT.storage : Free decentralized storage and bandwidth for NFTsAcknowledgmentsThis project was funded through theNext Step Microgrant, a program established byProtocol Labs.Show your supportStar this repoGive a ⭐️ if this project helped you!Donate to our projectIf you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-) .Bitcoin1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCyEthereum0xcD4Db18B6664A9662123D4307B074aE968535388LitecoinLdnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZDogeDDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDhTronTCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7RipplerN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qqBinance Coinbnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qefTether0xcD4Db18B6664A9662123D4307B074aE968535388DashXd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3sStellarGALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNLZilliqazil1knmz8zj88cf0exr2ry7nav9elehxfcgqu3c5e5CoffeeteGitcoinChangelogAll notable changes to this project will be documented in this file.The format is based onKeep a Changelogand this project adheres toSemantic Versioning.Unreleased1.1- 2023-04-05Added__version__attributepython_versionattributeget_python_versionfunctionRANDOM_EQUATION_MIN_COMPLEXITYparameterRANDOM_EQUATION_FOF_MAX_DEPTHparameterRANDOM_EQUATION_FOF_MIN_DEPTHparameterrotatefunctionChangedrotationparameter added toplotmethodtimeoutparameter added tonft_storagemethodload_configfunction modifiednft_storage_uploadfunction modifiedRandom mode modifiedRANDOM_EQUATION_GEN_COMPLEXITYparameter renamed toRANDOM_EQUATION_MAX_COMPLEXITYREADME.mdupdated1.0- 2022-12-14AddedMarkerenumget_datafunctionget_configfunctionChangedmarkerparameter added toplotmethodupload_dataparameter added tonft_storagemethodupload_configparameter added tonft_storagemethodgeneratemethod optimizedTest system modifiedREADME.mdupdatedPython 3.11added totest.ymlplotmethod warning bug fixedRandom mode modifiedRemovedfill_datafunction0.9- 2022-09-28AddedAnaconda workflowChangedREADME.mdupdatedCODE_OF_CONDUCT.mdupdateddemo.ipynbupdatedcmapparameter added toplotmethodRandom mode modifiedTest system modifiedgeneratemethod optimizedsamila_helpfunction updatedload_dataandload_configfunctions error handling updated0.8- 2022-06-01AddedINVALID_COLOR_TYPE_ERRORerrorCOLOR_NOT_FOUND_WARNINGwarningBOTH_COLOR_COMPLEMENT_WARNINGwarningset_backgroundfunctionis_valid_colorfunctioncolor_complementfunctionselect_colorfunctionChangedTransparent mode support forbgcolorparameterRandom mode modifiedComplementary color support forcolorandbgcolorparametersfilter_colorfunction modified0.7- 2022-05-04Addedfill_datafunctionrandom_hex_color_genfunctioncolor,bgcolorandprojectionparameters random modeChangedCalculation warning added togeneratemethodHex color support forcolorandbgcolorparametersTest system modifiedRandom mode modifiedfilter_colorfunction modifiedfilter_projectionfunction modifiedis_same_datafunction modifiedREADME.mdupdated0.6- 2022-04-13Addedsave_params_filterfunctionChanged__del__method updatedmessagefield changed insave_fig_filefunctionmessagefield changed insave_config_filefunctionmessagefield changed insave_data_filefunctionmessagefield changed innft_storage_uploadfunctiondepthsection added to config/data filelinewidthparameter added toplotmethodlinewidthparameter added toplot_params_filterfunctionRandom mode modifiedREADME.mdupdated0.5- 2022-03-21Added__del__methodDemo notebookChangeddepthparameter added tonft_storagemethoddepthparameter added tosave_fig_buffunctionalphaparameter added toplotmethodalphaparameter added toplot_params_filterfunctionRandom mode modifiedREADME.mdupdated0.4- 2022-01-13AddedPLOT_DATA_ERRORerror message_GI_initializerfunctiongenerate_params_filterfunctionplot_params_filterfunctionfilter_sizefunctionsave_configmethodload_configfunctionsave_config_filefunctionsamilaConfigErrorclasssamilaPlotErrorclassfilter_floatfunctionRandom equations modefunction1_strattributefunction2_strattributeChangedREADME.mdupdatedplotsection added to data fileedgecolorchanged tocinplotmethodconfigparameter added to GenerativeImage__init__filter_projectionfunction editedTest system updatedRemovedNO_FUNCTION_ERRORerror messageDATA_PARSING_ERRORerror messageJUST_DATA_WARNINGwarning message0.3- 2021-11-10AddedDiscord channelload_datafunctionsave_data_filefunctionsave_datamethodChangeddataparameter added to GenerativeImage__init__methoddepthparameter added tosave_imagemethoddepthparameter added tosave_fig_filefunctionsave_imageandnft_storagemethods background bug fixedREADME.mdupdatedTest system updatedPython 3.10added totest.yml0.2- 2021-10-14Addeddependabot.ymlrequirements-splitter.pysamila_helpfunctiontest.pyfunction_test.pyoverall_test.pynft_upload_test.pyis_same_datafunctionsave_imagemethodChangeddev-requirements.txtupdatedREADME.mdupdated__main__.pyupdatedTest system updatednft_storagemethod updated0.1- 2021-09-30AddedGenerativeImageclassplotmethodgeneratemethodnft_storagemethod