Skip to main content

Utility to convert Excel tables to a sqlite database and access the data

Project description

SASA Database

I don't think this is usable by anyone lese but it's a dependency to sasa_stacker and I wanted to package it separately. An explanation to the whole project can be found here.

Usage

exl_to_sql.py -h:


exl_to_sql.py [-h] [-n SHEET_NUMBER] [-v] [-s] exl db

positional arguments:
  exl                   path to excel-file
  db                    path to sqlite3-db


optional arguments:
  -h, --help            show this help message and exit
  -n SHEET_NUMBER, --sheet-number SHEET_NUMBER
                        which excel-sheet to convert
  -v, --verbose         verbose output
  -s, --skip-existing   skipping rows already contained in the db

Writes the excel file exl into the sqlite database db. Every row in the Excel sheet represents one simulation run of metasurfaces. The problem is with our current setup they are saved as one big .mat file but the sasa_stacker needs to access them and their parameters individually. This script assigns each single metasurface an address and saves its parameters in the db separately. Examples for the formating of the excel sheet can be found in data/NN_smats.xlsx.

Crawler

The Crawler class allows access to the db and loads the simulation data. The main functions are:

find_smat

Crawler.find_smat(name, adress=None)

Loads the simulation data to name. If an adress is provided it only loads this single S-matrix.

Arguments

  • name: string, name of the simulation in the database
  • adress: list, for example [1,4,5,3] the adress can also be found in the database

find_smat_by_id

Crawler.find_smat_by_id(id)

Same as above but takes the simulation id

Arguments

  • id: int, simulation id found in the database

extract_params

Crawler.extract_params(id)

Queries meta_materials.db for all the parameters to the given ID.

Arguments

  • id: int, simulation id found in the database

Returns

  • param_dict: dict, contains the combined data from the simulations and geometry tables with coresponding names

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sasa_db-0.1.tar.gz (112.5 kB view details)

Uploaded Source

Built Distribution

sasa_db-0.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file sasa_db-0.1.tar.gz.

File metadata

  • Download URL: sasa_db-0.1.tar.gz
  • Upload date:
  • Size: 112.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for sasa_db-0.1.tar.gz
Algorithm Hash digest
SHA256 fb049ff9e493ea292a9d90ba66baa81dbb6d4364e3a214fb5c90b771ad80e1f4
MD5 9d8342f2fcba6e90f81676b71a1c29f7
BLAKE2b-256 7d0f20a0a4c444b55384cf25f5a3f505f8615e0a0139efb1b42623f3c67a294e

See more details on using hashes here.

File details

Details for the file sasa_db-0.1-py3-none-any.whl.

File metadata

  • Download URL: sasa_db-0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for sasa_db-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f5b95490b70ca86620f2f97bd48e42ee76f2b40e55327fa52d47c84482638da5
MD5 92b02a023e16d219839b7796c0a3e72d
BLAKE2b-256 37aabd954bd2459da5b60101dc4f201ab2be0befe3d696f9d8572747380de4ed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page