This repository contains the analysis code for the HRV (Heat Recovery Ventilation) study, examining the effects of positive pressure ventilation units on indoor environmental conditions in 30 houses monitored over two winter seasons (2008 and 2009) in West Auckland, New Zealand.
- 30 houses total: 20 active homes (with ventilation units) and 10 control homes
- Monitoring periods:
- 2008: July 28 - October 24 (winter/spring)
- 2009: June 15 - September 11 (full winter)
- Measurements: Temperature, relative humidity, and pollutants in living rooms, bedrooms, and roof cavities
- Control houses: 5, 7, 12, 16, 17, 21, 23, 25, 28, 30
- Active houses: All others (1-30 excluding control houses)
- Week 1 of 2008: No ventilation units (baseline)
- All other weeks: Ventilation units installed
hrv-study-analysis/
├── src/ # Core analysis modules
│ ├── utils.py # Data loading and processing utilities
│ ├── config.py # Configuration settings
│ └── statistical_tests.py # Statistical testing functions
├── scripts/ # Analysis scripts for research questions
│ ├── question_01.py # Outside temperature comparison
│ ├── question_02.py # Full day temperature comparison
│ ├── question_03.py # Part of day temperature comparison
│ ├── question_04.py # Temperature exposure analysis
│ ├── question_05.py # Roof cavity 18°C analysis
│ ├── question_06.py # Outside conditions for 18°C
│ ├── question_07.py # Full day RH comparison
│ ├── question_08.py # Part of day RH comparison
│ ├── question_09.py # Comfort zone analysis
│ └── question_10.py # Roof cavity air quality
├── notebooks/ # Jupyter notebooks for exploration
├── results/ # Output directory
│ ├── figures/ # Generated plots
│ ├── tables/ # Generated tables
│ └── reports/ # Summary reports
└── tests/ # Unit tests
git clone <repository-url>
cd hrv-study-analysis# Using venv
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Or using conda
conda create -n hrv-analysis python=3.9
conda activate hrv-analysispip install -r requirements.txtThe data path can be configured in three ways (in order of precedence):
Create a .env file from the template:
cp .env.example .envEdit .env and set your data path:
HRV_DATA_PATH=/path/to/your/dataSet the environment variable in your shell:
# Linux/Mac
export HRV_DATA_PATH=/path/to/your/data
# Windows Command Prompt
set HRV_DATA_PATH=C:\path\to\your\data
# Windows PowerShell
$env:HRV_DATA_PATH="C:\path\to\your\data"Set the path in your Python code:
from src.config import set_data_path
set_data_path('/path/to/your/data')If no path is configured, the system will look for data in the data/ subdirectory of the project.
Your data directory should have the following structure:
your_data_path/
└── house_data/
└── preprocessed/
├── 18_01.csv # Week 1, Year 2008, House 01
├── 28_01.csv # Week 2, Year 2008, House 01
├── 19_01.csv # Week 1, Year 2009, House 01
├── 29_01.csv # Week 2, Year 2009, House 01
└── ... # Files for all 30 houses# Check configuration
python -c "from src.config import print_config; print_config()"
# Test data loading
python -c "from src.utils import load_house_data; df = load_house_data(1, 8, 1); print(f'Loaded {len(df)} records')"This analysis uses solar irradiance to define daytime and nighttime periods, rather than fixed clock times:
- Daytime: Solar irradiance ≥ 0.005 W/m²
- Nighttime: Solar irradiance < 0.005 W/m²
This provides a more accurate representation of actual daylight conditions than fixed time periods (e.g., 9am-5pm), especially important for:
- Seasonal variations in daylight hours
- Weather-dependent solar availability
- Roof cavity heating analysis
The system will automatically:
- Use solar irradiance data when available (column
ext__SR) - Fall back to fixed times (9am-5pm) if solar data is missing
- Log statistics about actual daylight hours for each analysis
Each CSV file should contain:
timestamps: DateTime column in format 'yyyy-mm-dd hh:mm:ss'- Temperature columns:
T-LWY,T-BWY,T-RWY(Living, Bedroom, Roof) - Relative humidity columns:
RH-LWY,RH-BWY,RH-RWY - External data:
ext__T,ext__SR,ext__RH,ext__WD,ext__WS
Where:
- W = Week number (1 or 2)
- Y = Year (8 for 2008, 9 for 2009)
from src.utils import load_house_data, get_group_statistics
from src.statistical_tests import independent_t_test
# Load data for House 1, Week 1, Year 2008
df = load_house_data(week=1, year=8, house_num=1)
# Get statistics for active homes
stats = get_group_statistics(week=1, year=8, variable='T',
location='L', group='active')
# Perform t-test
result = independent_t_test(group1_data, group2_data)- Q1: Was outdoor temperature different between active and control home locations?
- Q2: Were active homes warmer than control homes for the whole day?
- Q3: Were active homes warmer than control homes for part of the day?
- Q4: Difference in exposure to extreme temperatures and WHO recommendations?
- Q5: Is it possible to reach 18°C in roof cavity during winter?
- Q6: What outdoor conditions are needed for 18°C in roof cavity?
- Q7: Was relative humidity lower in active homes for the whole day?
- Q8: Was relative humidity lower in active homes for part of the day?
- Q9: Were active home occupants in comfort zone longer?
- Q10: How often was roof cavity air warmer and drier than living areas?
- Independent samples t-tests: Compare active vs control homes
- Paired t-tests: Compare before/after ventilation installation
- ANOVA: Compare multiple groups or time periods
- Confidence intervals: 95% CI for all estimates
- Effect sizes: Cohen's d for practical significance
- Time series analysis: For temporal patterns
- Non-parametric tests: When normality assumptions are violated
Results are saved in the results/ directory:
- Figures: PNG and PDF formats for all plots
- Tables: CSV and Excel formats for statistical results
- Reports: HTML and PDF summary reports
For questions about the analysis or data, please contact the research team.
If you use this code or data, please cite:
[Citation information to be added]