spacetelescope / astronify Goto Github PK
View Code? Open in Web Editor NEWAstronomical data sonification.
Home Page: https://astronify.readthedocs.io
Astronomical data sonification.
Home Page: https://astronify.readthedocs.io
utils.pitch_mapping.data_to_pitch
Needs:
center_point
-> zero_point
should be able to take Hz, "median" or "mean"Give SoniSeries a print function that prints out relevant info.
Allow users to select the pitch range they are most comfortable listening to for Astronify snapshot functionality (and for the main functionality), for more accessibility.
Create function to easily add a regular beat behind sonification that acts as tics on the time axis. (default to data time, ie: 4 days)
User should be able to define the frequency of the beat.
Write up a condition to catch for when n_spacing
creates a .wav file that takes too long (>10 seconds?). Given the n_spacing + the num. of individual data points that will be sonified, calculate the length of time it will take to sonify the entire data table. If it takes too long, warn the user and let them know their n_spacing
is too large.
Currently the only option is to get an output fits file, would be nice to also get the output as a table, which could be directly handed to the sonification code.
While not expected in real data, when I tried to sonify a simulated light curve that was perfectly constant (all fluxes were exactly the same value) I got "divide by zero" errors and no sound. I suspect the problem is in calculating one or more ranges for setting some parameters. The expectation is that if the array is exactly all the same value, one should get a constant tone out.
I am unable to make a call to write() on a sonified object. I haven't debugged it a ton yet, but it seems there is an order-of-operations problem in the _write() pyo statement (at least for me) where it again causes an error about the server being booted.
It complains around this set of code:
` self.server.reinit(audio="offline")
self.server.boot()
self.server.recordOptions(dur=delays[-1]+duration, filename=filepath)
env = pyo.Linseg(list=[(0, 0), (0.1, 1), (duration - 0.1, 1),
(duration - 0.05, 0.5), (duration - 0.005, 0)],
mul=[self.gain for i in range(len(pitches))]).play(
delay=list(delays), dur=duration)
sine = pyo.Sine(list(pitches), 0, env).out(delay=list(delays),
dur=duration)
self.server.start()`
where it is unhappy with the .play() command inside the 'env' line. I tried moving the server.start() above the env line, but no avail.
Haven't done a ton of testing for edge cases, especially for transit signals that end right near / on / right after the end of the light curve array to make sure the code doesn't miss the final bin, or add an extra, etc.
Add links to easily move between docs sections and a link back to the home page within each section.
Read the Docs side bar currently only shows links within that section, but not for the entire project.
Several examples in the main docs require lightkurve, it should be possible to add lightkurve as a required package just for the doctests.
While I am able to hear sound as expected for a single .play() command in a Python notebook, if running as part of a script from the command line I do not hear any sound at all, just a very brief "click" from my speakers.
Add ability to sonify multiple objects in different channels allowing more than one dataset to play at the same time
Allow for more flexibility in input formats
When writing a soundfile if the output directory does not already exist it won't write and gives a cryptic error message. Instead it should create the directory.
Ensure that amplitudes are being properly calculated with np.trapz
, and run tests.
We have issues with calculating the total area and standard deviation error when data points go into the negative y-axis. The current possible solution for this would be to offset all the data by some value to shift it up and out of the negatives, but this would be creating false flux and therefore auditory comparison between spectra would not be possible in the future.
The simulator needs unit tests.
Ultimately we want a suite of jupyter notebooks that is:
This will be a significant effort, but also a significant enhancement. Use https://github.com/spacetelescope/notebooks as a guide.
The Astropy template come with a number of example files. These need to be removed from the repository.
Add more user controls:
Create a way for a user to test their hearing so they can learn optimal pitch outputs to use when sonifying data they want to study
Similar to how fancy earbuds do this when you first configure them
Within a Python notebook, I am unable to run a .play() on more than one sonified object. The error I get is one where it states "the server must be botted before...", the first call to .play() works as expected, but a second call to another sonified object fails.
Write Python function that generates mp4 animation by combining the .gif graph images and .wav sonification sound.
@ceb8 has notebook with code to get started with this
Hello. The Astropy Project has decided to retire pytest-openfiles, a plugin to detect open files in pytest runs. We see that you are using it in this repo. While you may continue to use it, please be advised that it will no longer be maintained going forward. See https://github.com/astropy/pytest-openfiles#important-retirement-roadmap for more information. We apologize for any inconvenienced cause.
If this issue was opened in error and is irrelevant, feel free to close.
Thank you for your patience.
Currently the Jupyter kernel will die if sonify() is given a set of fluxes with NaN values in it. These should be filtered out, or the algorithm should be made NaN-safe, depending on our decision for a mitigation strategy. Kepler/K2 data can sometimes have NaN values in the time array to, so the solution should be applied to both the time and flux axes.
Sometimes we end up with a 6th bin (filled with zeros, so does not affect the actual output) probably due to the num. of data points not being divisible by 5. Low priority, but still needs to be addressed.
Above a certain number of data points (somewhere between the number in a Kepler long cadence light curve and the number in a Kepler short cadence light curve) playing or writing a sonification starts to hang and kill the kernal. Ideally we would fix Astronofy so that any length is fine. But if that is not possible at the least there should be a hard limit and error thrown so that unsuspecting users do not repeatedly kill their kernel not knowing what the problem is.
Readthedocs documentation to the level where we can show it to users
Add thinkdsp functionality.
There's a known bug where if given an array that all the same flux value it returns the data zero point instead of the center ptich value.
Allow for users to write the snapshot audio output into a .wav
file
It's possible and in fact too easy to overwhelm the speaker and get unpleasant sounds, we need to implement automatic clipping so this can't happen.
Hi,
I heard the other day about Astronify, what a great project!
As I started exploring and creating sound objects. In Jupyter Notebook I can play simultaneously several files just by having multiple soni_obj.play()
one after the other, however, I can .wirte()
only individual files, so I was wondering is it possible to write all into a file - as it is played?
I'm using it to sonify galaxy groups - therefore, trying to test how clear would be to hear an entire group of galaxies played/saved at the same time.
I'm trying to install astronify
at the Rubin Science Platform (RSP) in data.lsst.cloud
to create a short Jupyter Notebook demonstration on how to use astronify
with LSST-like data.
At first, pip install --user astronify
would run into problems with portaudio
(the details are in this public forum question: https://community.lsst.org/t/installing-astronify-via-homebrew-on-rsp-notebooks/8066). A colleague from Rubin suggested doing a minimal installation of pyo
to exclude portaudio
since portaudio
is used when you want to play audio on the same computer that you’re running the code on, but on the RSP the code runs in a data center somewhere, so instead you need to use IPython to interface with the browser to play the audio. This solution worked fine as of November of 2023, but now the following error message appears when trying to import astronify
in a notebook:
ImportError: libsndfile.so.1: cannot open shared object file: No such file or directory
A colleague from Rubin suggested that astronify
might be out of date with respect to the astropy
built into rubin-env
, which has astropy
6.0.0.
.
Seeing as uncertainty is vital to communicating scientific results properly, I was wondering if there are ways to use astronify
to embed uncertainty information in outputs? I noticed that SoniSeries
doesn't explicitly support this, but workarounds and hacks for doing this would be useful.
Update theme. (We like this one https://docs.ansible.com/ansible/latest/index.html)
Update colors to match our scheme #0D4960 #00617E)
Currently we're doing one stream per note, this seems unnecessary and spawns way too many streams. Figure out a better way to do this.
Add basic testing framework
For transit simulator or case of top of square (e.g., square wave) the output sound isn't as expected. One would expect two distinct sounds at roughly 1/3 and 2/3 the allowed tone range, but instead it is basically monotone. This could be a bug, or could be result of algorithm being used, will investigate.
Create a way for a user to name and store a group of configs for things like pitch, speed, timing, point spacing, etc.
This can also be used to name and store default configs for different types of data
(ie: flares vs transit).
Add additional information to the readme
ImportError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import astronify
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\astronify_init_.py:7
1 # Licensed under a 3-clause BSD style license - see LICENSE.rst
2
3
4 # Packages may add whatever they like to this file, but
5 # should keep this content at the top.
6 # ----------------------------------------------------------------------------
----> 7 from ._astropy_init import * # noqa
8 # ----------------------------------------------------------------------------
11 from . import series # noqa
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\astronify_astropy_init.py:21
19 import os
20 from warnings import warn
---> 21 from astropy.config.configuration import (
22 update_default_config,
23 ConfigurationDefaultMissingError,
24 ConfigurationDefaultMissingWarning)
26 # Create the test function for self test
27 from astropy.tests.runner import TestRunner
ImportError: cannot import name 'update_default_config' from 'astropy.config.configuration' (C:\Users\Utente\AppData\Local\Programs\Python\Python311\Lib\site-packages\astropy\config\configuration.py)
Thanks for any help on how to fix it.
The simulator is really just sharing a repo with Astronify right now. At some point it should actually be integrated into the package properly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.