The city you live in could be the reason behind your good night’s sleep or lack thereof.

A study from the U.S. News & World Report’s 360 reviews ranked two California cities among the “best” places for sleep health, while other cities in the Golden State ranked low on the list.

San Diego and San Jose ranked fourth and ninth for the “best” places for a good night’s sleep, researchers found. Fresno and Long Beach were considered the “worst” places for sleep health. The cities ranked in the 39th and 40th positions, respectively.

California cities named on the list:

4th: San Diego

9th: San Jose

13th: Bakersfield

25th: San Francisco

31st: Oakland

33rd: Sacramento

34th: Los Angeles

39th: Fresno

40th: Long Beach

Researchers compared 50 of the top cities in the U.S. across five key factors sleep health-based metrics, including air quality, noise pollution, light pollution, physical activity and sleep duration.

 Researchers assigned weighted percentages to each of the five key metrics to reach 100%, with a perfect score representing the “best” city for a good night’s sleep.

The breakdown of the metrics is as follows:

Noise Pollution: 20%

Light Pollution: 15%

Air Pollution: 5%

Physical activity: 15%

Prevalence of Short Sleep Duration: 45%

Researchers used publicly available data in the study.

The “best” city for sleep health was Austin, Texas, according to the study, while the “worst” city was Philadelphia, Pennsylvania.