A Perth police officer who shook his crying newborn baby as he tried to settle her has been given a community-based order instead of jail.