- Start the Test IOC:
cd test/
python3 test_ioc.py- In another terminal, test the logger:
# If installed as package
pyepicslogger TEST:HEARTBEAT --verbose
# If running from source
python3 pyEpicsLogger/epicsLogger.py TEST:HEARTBEAT --verbose
# Legacy compatibility (pvMonitor.py still works)
python3 pvMonitor.py TEST:HEARTBEAT --verboseThe test IOC provides these PVs:
TEST:HEARTBEAT- Toggles between 0 and 1 at 1HzTEST:COUNTER- Counts the number of transitionsTEST:STATUS- IOC status (0=STOPPED, 1=RUNNING)TEST:FREQUENCY- Adjustable frequency (0.1-10.0 Hz)TEST:TEMPERATURE- Simulated temperature sensor with noiseTEST:PRESSURE- Simulated pressure sensorTEST:FLOW- Simulated flow meterTEST:ALARM- Test alarm state changes
# Terminal 1: Start IOC
cd test/
python3 test_ioc.py
# Terminal 2: Monitor with default settings (1Hz ± 0.2s)
pyepicslogger TEST:HEARTBEAT --verbose# Monitor multiple channels and save to data directory
pyepicslogger TEST:HEARTBEAT TEST:COUNTER TEST:TEMPERATURE \
--data-file "test_run_$(date +%Y%m%d_%H%M%S).csv" \
--verbose
# The CSV file will be automatically saved to data/# Change frequency to 2 Hz
caput TEST:FREQUENCY 2.0
# Monitor expecting 1Hz (will show timing anomalies if using pvMonitor)
python3 pvMonitor.py TEST:HEARTBEAT --period 1.0 --tolerance 0.2 --verbose
# Monitor multiple channels with pyEpicsLogger
pyepicslogger TEST:HEARTBEAT TEST:COUNTER --verbose# Start IOC with custom device name
python3 test_ioc.py --device MYTEST
# Monitor the custom PV
pyepicslogger MYTEST:HEARTBEAT --verbose# Start IOC at 0.5 Hz
python3 test_ioc.py --frequency 0.5
# Monitor with pyEpicsLogger
pyepicslogger TEST:HEARTBEAT --verbose --data-file "slow_heartbeat.csv"# Create a PV list file
echo -e "TEST:HEARTBEAT\nTEST:TEMPERATURE\nTEST:PRESSURE\nTEST:FLOW" > test_pvs.txt
# Monitor using file input
pyepicslogger --file test_pvs.txt --data-file "multi_channel_test.csv" --verboseFor automated testing, use the provided test script:
cd test/
chmod +x test.sh
./test.shThis provides a menu-driven interface for various test scenarios including:
- Starting the IOC
- Running multi-channel tests
- Testing data logging to CSV files
- Testing file input methods
- Frequency change testing
# Install package first
pip install -e .
# Use the command anywhere
pyepicslogger TEST:HEARTBEAT TEST:COUNTER --verbose --data-file test.csv# From repository root
python3 pyEpicsLogger/epicsLogger.py TEST:HEARTBEAT --verbose
# Legacy pvMonitor.py (still works for backward compatibility)
python3 pvMonitor.py TEST:HEARTBEAT --verboseIf you have EPICS tools installed:
# Check current values
caget TEST:HEARTBEAT TEST:COUNTER TEST:STATUS TEST:FREQUENCY
# Monitor continuously
camonitor TEST:HEARTBEAT
# Change frequency
caput TEST:FREQUENCY 2.0
# Stop/start heartbeat
caput TEST:STATUS 0 # Stop
caput TEST:STATUS 1 # Start
# Monitor all test PVs
camonitor TEST:HEARTBEAT TEST:COUNTER TEST:TEMPERATURE TEST:PRESSURE# Test automatic data directory creation
pyepicslogger TEST:HEARTBEAT TEST:TEMPERATURE \
--data-file "experiment_$(date +%Y%m%d_%H%M%S).csv" \
--verbose
# Check that file was created in data/ directory
ls -la data/# Test log file creation
pyepicslogger TEST:HEARTBEAT --log-file "test.log" --verbose
# Test both data and log files
pyepicslogger TEST:HEARTBEAT TEST:COUNTER \
--data-file "test_data.csv" \
--log-file "test.log" \
--verbose# Set IOC to maximum frequency
caput TEST:FREQUENCY 10.0
# Monitor high-frequency changes
pyepicslogger TEST:HEARTBEAT --verbose --data-file "high_freq_test.csv"# Monitor all available test PVs
pyepicslogger TEST:HEARTBEAT TEST:COUNTER TEST:TEMPERATURE \
TEST:PRESSURE TEST:FLOW TEST:ALARM \
--data-file "load_test.csv" --verboseIOC won't start:
- Check if softioc is installed:
pip install softioc - Verify no other IOC is using the same PV names
- Check for port conflicts
Logger can't connect:
- Ensure IOC is running first
- Check PV name spelling
- Verify EPICS environment variables if needed
- Try:
caget TEST:HEARTBEATto test basic connectivity
Package command not found:
- Install the package:
pip install -e . - Check if
~/.local/binis in your PATH - Use absolute path:
python3 -m pyEpicsLogger.epicsLogger
Data files not in data/ directory:
- Check if you're using absolute paths
- Verify write permissions in current directory
- Check if data/ directory was created:
ls -la data/
No timing anomalies detected (pvMonitor.py):
- Try changing the IOC frequency:
caput TEST:FREQUENCY 2.0 - Use stricter tolerance:
--tolerance 0.1 - Monitor with wrong expected period to force anomalies
# Test with clock offset
pyepicslogger TEST:HEARTBEAT --offset 0.1 --verbose --data-file "offset_test.csv"# Test PV prefix functionality
pyepicslogger HEARTBEAT COUNTER --prefix "TEST:" --verbose# Test with non-existent PV (should show connection errors)
pyepicslogger TEST:NONEXISTENT --verbose
# Test mixed valid/invalid PVs
pyepicslogger TEST:HEARTBEAT TEST:INVALID TEST:COUNTER --verboseFor more detailed testing procedures and troubleshooting, see the main README.md.