from django import forms
from obspy.core.utcdatetime import UTCDateTime

STA = (
	('AM.R06AC.00.EHZ','Orono, ME - R06AC'),
	('AM.RCB43.00.SHZ','Poland, ME - RCB43'),
)

class ShakeForm(forms.Form):
	sta = forms.CharField(help_text='seismic station used for processing', label='Station name', widget=forms.Select(choices=STA), required=True)

	start = forms.DateTimeField(help_text='utc datetime formatted as yyyymmddhhmmss', label='Start date and time', required=True)

	dur = forms.IntegerField(help_text='for best results, duration should be 10 - 1000 sec', label='Duration (seconds)', min_value=1, max_value=3600, required=True)

	filtmin = forms.FloatField(help_text='0 to 25 Hz', label='Minimum bandpass filter frequency', min_value=0, max_value=25, required=True)

	filtmax = forms.FloatField(help_text='0 to 25 Hz', label='Maximum bandpass filter frequency', min_value=0, max_value=25, required=True)

	dbscale = forms.BooleanField(help_text='if checked, color axis will be rendered on a log scale (10*log10); if unchecked, simply as square root', label='Color scale log switch', initial=False)

	logscale = forms.BooleanField(help_text='if checked, will render the frequency axis on a log scale', label='Log scale switch', initial=False)


	def __init__(self, *args, **kwargs):
		super(ShakeForm, self).__init__(*args, **kwargs) # Call to ModelForm constructor
		self.fields['start'].widget.attrs['cols'] = 15
		self.fields['dur'].widget.attrs['cols'] = 7
