Errors due to field nonuniformity in vibrating sample magnetometry