<commit_before>import time
from datetime import datetime, timedelta
import pytz
import Adafruit_ADS1x15


# _____________Site Specific settings____________________

siteCode = "Richards_Hall"              # Location of the reading
scanIntervalStr = "500ms"               # String used in the output file name
# scanInterval = 0.50                     # Time between scans within the main loop (sec)
recordInterval = 0.50                   # Time between recorded values (sec)
maxFlowRate = 250.0                     # Max flow corresponding to a 20mA output (gal/min)
calibrationFactor = 1.0                 # Scale output voltages to one point calibration

# __________________Gain Settings_________________________

adc = Adafruit_ADS1x15.ADS1115()        # Initialize the 16 bit ADC
# This setting changes the range of voltages that are read
# See table 3 in the ADS1015/ADS1115 data-sheet for more info on gain.
#  - 2/3 = +/-6.144V 1 bit = 3 mV
#  -   1 = +/-4.096V 1 bit = 2 mV
#  -   2 = +/-2.048V 1 bit = 1 mV
#  -   4 = +/-1.024V 1 bit = 0.5 mV
#  -   8 = +/-0.512V 1 bit = 0.25 mV
#  -  16 = +/-0.256V 1 bit = 0.125 mV
GAIN = 1
bitConversion = 0.125

# ___________________Data Log Output File__________________

localTime = time.localtime(time.time())
outputFilePath = '/home/pi/CampusMeters/datalogs/'
outputFileName = 'datalog_' + scanIntervalStr + '_' + siteCode + '_' + str(localTime.tm_year) \
                 + '-' + str(localTime.tm_mon) + '-' + str(localTime.tm_mday) \
                 + '_' + str(localTime.tm_hour) + ':' + str(localTime.tm_min) \
                 + ':' + str(localTime.tm_sec) + '.csv'

# .csv file heading
loggerName = '\"Campus Meter Data log for: ' + siteCode + '\"'
print loggerName

dataHeader = '\"Date\",\"RecordNumber\",\"SensorVoltage\",\"FlowRate\",\"AvgFlowRate\",' \
             '\"IncrementalVol\",\"TotalVol\"'
print dataHeader

# open and write heading to the .csv file
with open(outputFilePath + outputFileName, 'w') as outputFile:
    outputFile.write(loggerName + '\n')
    outputFile.write(dataHeader + '\n')

# _____________________Timing Variables______________________
# Initial set up of timing variables, these reset every epoch.
sampleNumber = 1
currTime = 0.0
prevTime = 0.0
prevRecTime = 0.0
timeInterval = 0.0
tmDelta = timedelta(millisecond=500)

# Arizona Mountain Standard Time (MST) == UTC -7.0
# This is always the case, because no DST.
mtnStdTm = pytz.timezone('MST')
now = datetime.now(mtnStdTm)

remainder = recordInterval - (now.second % recordInterval)<commit_msg>Set default frequency to 100ms<commit_after>import time
from datetime import datetime, timedelta
import pytz
import Adafruit_ADS1x15


# _____________Site Specific settings____________________

siteCode = "Richards_Hall"              # Location of the reading
scanIntervalStr = "100ms"               # String used in the output file name
recordInterval = 0.10                   # Time between recorded values (sec)
maxFlowRate = 250.0                     # Max flow corresponding to a 20mA output (gal/min)
calibrationFactor = 1.0                 # Scale output voltages to one point calibration

# __________________Gain Settings_________________________

adc = Adafruit_ADS1x15.ADS1115()        # Initialize the 16 bit ADC
# This setting changes the range of voltages that are read
# See table 3 in the ADS1015/ADS1115 data-sheet for more info on gain.
#  - 2/3 = +/-6.144V 1 bit = 3 mV
#  -   1 = +/-4.096V 1 bit = 2 mV
#  -   2 = +/-2.048V 1 bit = 1 mV
#  -   4 = +/-1.024V 1 bit = 0.5 mV
#  -   8 = +/-0.512V 1 bit = 0.25 mV
#  -  16 = +/-0.256V 1 bit = 0.125 mV
GAIN = 1
bitConversion = 0.125

# ___________________Data Log Output File__________________

localTime = time.localtime(time.time())
outputFilePath = '/home/pi/CampusMeters/datalogs/'
outputFileName = 'datalog_' + scanIntervalStr + '_' + siteCode + '_' + str(localTime.tm_year) \
                 + '-' + str(localTime.tm_mon) + '-' + str(localTime.tm_mday) \
                 + '_' + str(localTime.tm_hour) + ':' + str(localTime.tm_min) \
                 + ':' + str(localTime.tm_sec) + '.csv'

# .csv file heading
loggerName = '\"Campus Meter Data log for: ' + siteCode + '\"'
print loggerName

dataHeader = '\"Date\",\"RecordNumber\",\"SensorVoltage\",\"FlowRate\",\"AvgFlowRate\",' \
             '\"IncrementalVol\",\"TotalVol\"'
print dataHeader

# open and write heading to the .csv file
with open(outputFilePath + outputFileName, 'w') as outputFile:
    outputFile.write(loggerName + '\n')
    outputFile.write(dataHeader + '\n')

# _____________________Timing Variables______________________
# Initial set up of timing variables, these reset every epoch.
sampleNumber = 1
currTime = 0.0
prevTime = 0.0
prevRecTime = 0.0
timeInterval = 0.0
# change depending on scan interval
tmDelta = timedelta(millisecond=100)

# Arizona Mountain Standard Time (MST) == UTC -7.0
# This is always the case, because no DST.
mtnStdTm = pytz.timezone('MST')
now = datetime.now(mtnStdTm)

remainder = recordInterval - (now.second % recordInterval)
{'fraction_non_alphanumeric': 0.11630671686150189, 'fraction_numerical': 0.0424014265900535, 'mean_word_length': 3.0223107569721117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6015328', 'n_tokens_mistral': 1748, 'n_tokens_neox': 1545, 'n_words': 472}