Walk through all full resolution BED events and collect first non-zero ROT_RATE value
Executing this Notebook requires a personal STOQS server. Follow the steps to build your own development system — this will take a few hours and depends on a good connection to the Internet. Once your server is up log into it (after a cd ~/Vagrants/stoqsvm) and activate your virtual environment with the usual commands:
vagrant ssh -- -X
cd /vagrant/dev/stoqsgit
source venv-stoqs/bin/activate
Connect to your Institution's STOQS database server using read-only credentials. (Note: firewalls typically limit unprivileged access to such resources.)
cd stoqs
ln -s mbari_campaigns.py campaigns.py
export DATABASE_URL=postgis://everyone:guest@kraken.shore.mbari.org:5433/stoqs
Launch Jupyter Notebook on your system with:
cd contrib/notebooks
../../manage.py shell_plus --notebook
navigate to this file and open it. You will then be able to execute the cells and experiment with this notebook.
For the CCE campaign print the second ROT_RATE value (first non-zero value from backward difference) for all full resoltion BED events
db = 'stoqs_cce2015'
print(f"{'Activity Name':32s} {'Initial ROT_RATE (deg/sec)':26s} {'Initial A (g)'}")
print('-' * 32, '-' * 26, '-' * 13)
for act in Activity.objects.using(db).filter(name__contains='full').order_by('startdate'):
mps = (MeasuredParameter.objects.using(db)
.filter(measurement__instantpoint__activity=act)
.order_by('measurement__instantpoint__timevalue'))
irr = mps.filter(parameter__name='ROT_RATE')
ia = mps.filter(parameter__name='A')
print(f'{act.name:32s} {irr[1].datavalue:26.2f} {ia[0].datavalue:13.3f}')