{"id":15594936,"url":"https://github.com/gabraganca/quickstar","last_synced_at":"2026-01-08T01:07:42.859Z","repository":{"id":47531545,"uuid":"272101254","full_name":"gabraganca/quickstar","owner":"gabraganca","description":"Synthesize stellar spectrum through a REST API.","archived":false,"fork":false,"pushed_at":"2021-08-27T19:43:15.000Z","size":4833,"stargazers_count":1,"open_issues_count":14,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-04T10:56:55.971Z","etag":null,"topics":["api","astronomy","astrophysics","rest-api","scientific-computing","synspec"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabraganca.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":"gabraganca","issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-06-13T23:24:13.000Z","updated_at":"2023-10-17T17:07:09.000Z","dependencies_parsed_at":"2022-09-08T15:51:26.063Z","dependency_job_id":null,"html_url":"https://github.com/gabraganca/quickstar","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabraganca%2Fquickstar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabraganca%2Fquickstar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabraganca%2Fquickstar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabraganca%2Fquickstar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabraganca","download_url":"https://codeload.github.com/gabraganca/quickstar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246174609,"owners_count":20735417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","astronomy","astrophysics","rest-api","scientific-computing","synspec"],"created_at":"2024-10-03T00:42:18.335Z","updated_at":"2026-01-08T01:07:42.819Z","avatar_url":"https://github.com/gabraganca.png","language":"Fortran","funding_links":["https://liberapay.com/gabraganca"],"categories":[],"sub_categories":[],"readme":"# QuickStar\n\n![CI](https://github.com/gabraganca/quickstar/workflows/CI/badge.svg)\n[![codecov](https://codecov.io/gh/gabraganca/quickstar/branch/master/graph/badge.svg)](https://codecov.io/gh/gabraganca/quickstar)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nQuickStar provides the [Synspec][synspec-website] software built by Dr. Ivan Hubeny and Dr. Thierry Lanz as a web app, which can be use through the browser or as an API.\n\nClick in the image below to see a quick demo.\n\n[![Watch the video](https://img.youtube.com/vi/PvHixH5YV6I/maxresdefault.jpg)](https://youtu.be/PvHixH5YV6I)\n\n\n[synspec-website]: http://tlusty.oca.eu/Synspec49/synspec.html\n\n## Example of using the API\n\nThis is an example of how one can consume the API using Python but, since it is an API, it is language agnostic allowing you to use the tool of your choice (as long it makes web request available).\n\n[![asciicast](https://asciinema.org/a/345533.svg)](https://asciinema.org/a/345533)\n\n\nThe API runs asynchronously, so we need to send a POST request first with the stellar parameters to trigger the Synspec calculation. We will assume that QuickStar is running locally:\n\n```python\nimport json\nimport requests\n\nstellar_parameters = {\"teff\":20000, \"logg\":4.0, \"wstart\":4460, \"wend\":4500}\npost_response = requests.post(\n    'http://localhost:8000/synspec',\n    data=json.dumps(stellar_parameters)\n)\n\nif post_response.ok:\n    print(post_response.text)\n# {\"id\":\"046f8aa4-d25f-4dec-b7b1-9b1c6025e2da\"}\n```\n\nWith the request `id`, we can get the results:\n\n```python\nresult_id = json.loads(post_response.text)['id']\nget_response = requests.get(f'http://localhost:8000/synspec/{result_id}')\n\nif get_response.ok:\n    print(get_response.text)\n```\n\nWhich will return, by default, only the twenty first wavelength-flux pairs.\n\n```json\n{\n    \"id\": \"e5d0b55a-52f7-4c83-953e-aec86f155288\",\n    \"status\": \"SUCCESS\",\n    \"results\": [\n        {\n            \"wavelength\": 4460.0,\n            \"flux\": 33390000.0\n        },\n        ...\n        {\n            \"wavelength\": 4460.185,\n            \"flux\": 33500000.0\n        }\n    ],\n    \"finished_at\": \"2020-06-11T23:08:36.314996\",\n    \"total_count\": 4097\n}\n```\n\nTo get the full spectrum, it's necessary to paginate the results. The example below shows how to paginate the results\n\n```python\n# Get the ID in the response and send a request\nresult_id = json.loads(post_response.text)[\"id\"]\nget_response = requests.get(f\"http://localhost:8000/synspec/{result_id}\")\n\n# Get the fist part of the spectrum\nspectrum = []\nif get_response.ok:\n    spectrum.extend(json.loads(get_response.text).get(\"results\", []))\n\n# Paginate to get the rest of the spectrum\nwhile \"next\" in get_response.links:\n    get_response = requests.get(get_response.links[\"next\"][\"url\"])\n    if get_response.ok:\n        spectrum.extend(json.loads(get_response.text).get(\"results\", []))\n```\n\n## API Documentation\n\nThe API documentation can be accessed in:\n\n* \u003chttp://127.0.0.1:8000/docs\u003e, provided by [Swagger][api-swagger].\n* \u003chttp://127.0.0.1:8000/redoc\u003e, provided by [ReDoc][api-redoc].\n\n[api-swagger]: https://github.com/swagger-api/swagger-ui\n[api-redoc]: https://github.com/Redocly/redoc\n\n## Requirements\n\nThe API and Synspec are containerized so all you will need is:\n\n* [Docker][docker-install]\n* [Docker Compose][docker-compose-install]\n\n[docker-install]: https://docs.docker.com/get-docker/\n[docker-compose-install]: https://docs.docker.com/compose/install/\n\n## Deploying the services\n\nThe API is configured to run with Docker Compose. In your terminal, run.\n\n```bash\ndocker-compose up\n```\n\nThe command above will start the API with just one worker, which will not allow you to calculate multiple spectra in parallel. To start multiple workers, for example two, we need to use the following command:\n\n```bash\ndocker-compose up --scale worker=2\n```\n\nThis set up will allow to calculate two spectra in parallel.\n\nDepending of how you have installed Docker and Docker Compose, it is possible that you will need to run the docker commands above with `sudo`.\n\n\nAfter booting the services, the frontend can be accessed at [localhost](http://127.0.0.1).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabraganca%2Fquickstar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabraganca%2Fquickstar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabraganca%2Fquickstar/lists"}